Hey.... I am just days away from completing a year-long project and want to convert the netbeans project to a stand-alone java program that can be installed on another system without netbeans. YEAH! Sorry - did my happy dance!

the Program has a .main java file and about 15 other support java files. In addition there is a dozen jdbc derby databases.
The program needs to be installable to any location the user desired - I would recomend to a thumb drive for portability for the prog itself and the data it produces (5 output text files that are reloaded when restarted).

If I am correct, the java programs would need to be copied intact (preserving directory locations) to its new position (Temporarly to a .zip file and then to its final install location.

what my concern is the databases..... would they need to stay in the same directory name as stored on the developers computer to the new computer, or can they be put in a new subdirectory of the program, or a newly created directory on the users hard drive (Prefered).....

The program uses these databases very frequently, and some are quite large, so storing them on a thumb drive would seriously slow the program down at execution time. I do not believe that the databases are an Embedded type.

This is not a coding question obviously, more of requesting advice on what I might need to do or to think of to complete this project.
Thanks in advance for this and all the help everyone has given me in the past to complete this project.

Recommended Answers

All 9 Replies

Correction to the above:

Only the five text files need to be portable, and that is already taken care of. So I just need to install the program and databases to a fixed location on the harddrive of the new computer.....

hope that makes it easier....

The java classes and other resources just go into a jar file. For the databases maybe you could use System.getProperty to get the user's home directory and place the databases in a new directory inside the user directory - that should work on any OS. (You can also get a suitable temp directory via System.getProperty, should you need temp files at runtime)

I have got everything saved in a .rar file and transfered it to another computer. Basically I copied the entire directory structure which does include the databases to the new computer.

The program does run in as far as the coding but no database info so no info is loaded, however when it tries to load the databases I get the error:

java.sql.SQLNonTransientConnectionException:java.netConnectException: Error connecting to server localhost on port 1527 with message Connection refused:connect.

Database URL(one of them) = jdbc:derby://localhost:1527/Equipment_Mundane
the databases drivers is set to: org.apache.derby.jdbc.EmbeddedDriver

I researched the System.getProperty as you suggested and dunno what to do with it, one sight made me think that the driver for the databases isn't being loaded, or the system does not know the location of the databases.

suggestions?

That looks like some kind of server configuration problem???
But why are you running in server mode at all if you know the database is strictly local to your java application? Maybe you should be simply running Derby in embedded mode to avoid configuration and access problems?

James; could you send me some info (preferably with some examples) of how to convert this to an embedded database.... just tell me where to look and maybe I can figure it out....
thanks

It's trivial - the only difference is in the way you connect - just see the link in my previous post.

ok try to use Jsmooth software or launch4j

I am totally lost in setting this up as an embedded database. I am getting errors such as driver not found, and even when I try to get it back to where the program was running with client server, it is now doing the same. I think the databases themselves are ok, however I might have inadvertently changed the server settings. btw: I am using netbeans 7.1.2 I am definately missing something or some critical step... suggestions?

The solution that I found for my problem is that I had originally created the database in netbeans itself. What I should have done that upon initial design of the program that will use the databases, create the database FROM WITHIN THE ACTUAL PROGRAM ITSELF, NOT NETBEANS.

            String dbURL5 = "jdbc:derby:Databases\\Armor; create=true";
            Connection conn5 = DriverManager.getConnection(dbURL5);
            if (conn5 != null) {System.out.println("Connected to database - Armor");
            }

Be sure when you connect to the database (when it has NOT yet been defined or created), use the create=true. This creates and ensures that the database and the driver will work with each other. After this initial creation, you can use netbeans to define the record structure as well as the data contained inside.

It took a while to do (15 databases, some very large), but now it works as intended.

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.