I have a very complex java program written with net beans 7.1. It consists of 1 .java file that has a main(), and over 25 supporting .java files (most used for routines inside of tabs). In addition there are 15 different databases (embedded) associated with it. The program is virtually complete, and I need to export this project to a stand-alone Java application (including the databases) that is completely independent of net beans and may run on any system that supports Java. This is intended to be a desktop application, not a web based program.

I can run the program just fine while in netbeans. It connects to all databases and datafiles without a problem. The databases are embedded, and netbeans is set not to act as a server or open any of the databases.

When I try to run the jar file in the dist folder (the executable jar file), I get pop-up errors saying the database(s) do not exist. The databases are present in a subdirectory of the dist folder. Of course since the databases were not found, loading data from that point on stops, but all of the screens and programming are present and working, just no data to work with.

I know that the executable jar files that netbeans generates are not necessarily 'complete', and I suspect that it may be a class path problem (the path to the databases is not being made known). When I connect to the databases I use :

DriverManager.getConnection("jdbc:derby:Databases/Database_Name");

where Databases is the subdirectory where they are located. (Note: I prefer that the end user to be able to install the program in whatever location they desire on their system.)

Since the databases have already been created and known to be working in embedded mode, I do not include the create=true option. Is there a way in netbeans to make sure that the executable jar file knows where the databases are located and can be loaded when needed, or do I need to generate this file with a different application and what that app is, or is there some other solution that I have not thought of?

suggestions or comments are welcome.

Please disregard this info request..... I found the error and now it can be exported to a standalone application and RUN!

thanks anyway

Hi! May I know how you fix this? Your help will be highly appreciated! Thanks!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.