Forum Stats

  • 3,872,596 Users
  • 2,266,456 Discussions
  • 7,911,260 Comments

Discussions

Installer

843810
843810 Member Posts: 46,938
edited Jan 31, 2010 1:30AM in Java Desktop Applications
Greetings,

I am not sure if this is the place for this topic, wherever I can get the answer is where I'd like to look.

I am writing a Java program to be distributed to my business client (about 25-30 machines will be running this program). Each machine (obviously) will need to install Java, something I'm not too thrilled about but not too concerned about either.

What does concern me, however, is that the program requires a JDBC driver (for Firebird DBMS) called "Jaybird." The installation of Jaybird simply requires that the environment variables point to the correct .jar file. This is a process, however, that I would very much like to abstract from the client. I think it is just bad design to require the user to edit their environment variables, unless of course the software package was software-development-oriented.

Is there any way to create an installer that will install the driver for the user? I'm worried the answer to this is no (else, why would the Jaybird people not have already done that?). I have never created an installer of any kind, and I'm not sure how one would do so. Any advice would be greatly appreciated.

Thank you.
«1

Comments

  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    rwilson352 wrote:
    ...the program requires a JDBC driver (for Firebird DBMS) called "Jaybird." The installation of Jaybird simply requires that the environment variables point to the correct .jar file. ...
    How it the DB itself installed? Or is it already installed on all the target machines?

    Sounds suspect. Can you run the application by getting rid of the environment variable and simply adding the driver to the run-time class-path of the application?

    If so, and you can distribute this app. from a server, the problems are mostly over by deploying the app. using [Java Web Start|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp]. Simply add the driver into the JNLP as one of the resources. To ensure the end user has an appropriate level of the JRE installed to run the application, use the [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html#usingJnlp].
  • 843810
    843810 Member Posts: 46,938
    The database is installed on a central server machine that is connected to the desktops that will be running the software. ie, the connection strings point to a 192.168.1.0 computer that has the DBMS installed. The software that I am developing is meant to interact with that database. (I have 0% control over the database, it is an underlying database to an inventory management software package that cannot be changed or modified in any way whatsoever). The software I am writing does NOT go on the server machine. Only on the client desktops.

    I am open to WHATEVER options enable me to run this program on the client's machines, without necessitating them change their classpath variables for each computer.

    I have been reading online, and I am struggling to find the right words to ask, honestly. What I am looking for is a way to include the Jaybird JDBC drivers with the software. If I can do that WITHOUT an installation, that would be faaaantastic. I have no idea how to do that, though.

    The file that I plan to distribute is a .jar file that just immediately opens the software. Is there any way to "wrap" the JDBC driver within that .jar file, and let Java know that the driver is located within the .jar?

    Thank you.
  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    In all that reply I did not see the answer to the question..
    Can you run the application by getting rid of the environment variable and simply adding the driver to the run-time class-path of the application?
  • 843810
    843810 Member Posts: 46,938
    My apologies. The answer to the question is, I have no idea how to add the driver to the run-time classpath of the executable.

    I am using netbeans which auto-generates the .jar executable. I tinkered with the settings, and found that in the libraries there is a list of "compile-time" libraries and "run-time" libraries.

    I added the JDBC driver to the "run-time" library list but it didn't seem to make a difference, it still doesn't work. Not sure if I did it right...
  • darrylburke
    darrylburke Member Posts: 18,007
    edited Jan 30, 2010 10:14AM
    Did you read the appropriately named README.TXT that NetBeans places in the Dist folder?

    db
  • 843810
    843810 Member Posts: 46,938
    I did read the README. However, I am not 100% about what it's saying. After reading it 5 times through, I believe that what it's saying is all I need to do is include the lib folder with my .jar executable? As in, throw the .jar and /lib folder in a zip file, and tell the client to extract and run the .jar?

    I have relocated the .jar file from /dist to a random place on my computer and it runs fine and I have relocated the lib folder from /dist and the .jar still runs fine. Which, to me, says that they are independent of each other, the /lib and .jar that is.

    However, the .jar file does not work on my remote (test) machine by itself. I haven't tested it with the lib folder included, however. (I shall once I get home). The program throws a driver exception.

    I have a feeling I don't understand fully what the readme is actually trying to say, though.

    README: "The IDE also adds each of the JAR files to the Class-Path element in the application" I am trying to understand what this is saying. Is there a "CLASSPATH" resource within the program that it looks to when you say
    Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();
    ? I knew (I thought) that it looked at your system environment variables for the driver.

    Does anyone know where I can learn more about drivers, environment variables, and system resources? Honestly I am confused as to what the Class.forName().newInstance() method does at all. I just know it works and lets my program talk to the DB. =) (The Javadocs aren't much help, either honestly)

    But, what's more important than how and what the Class.forName method does, is where exactly is it looking for the org.firebirdsql.jdbc.FBDriver?? I know it's looking in the Jaybird JDBC driver .jar file, but how does it know where to find it? Is it looking at Environment Variables? Did Netbeans tell it where to look? Etc.

    I am learning as I go. =)
  • 843810
    843810 Member Posts: 46,938
    Ok, I just tested it on a remote machine with JUST my application on it, and it seems the /lib folder was the key. With the /lib folder, it runs fine. Without, it throws a Driver exception.

    Thank you for your help everyone. :) Although I'd love to just hand them a stupid single .jar file that they can double click and run by itself... a tag-along "must be there or else" /lib folder is an acceptable solution. Problem solved.

    Perhaps I will look into programming an installer to abstract even more stuff from the user, placing the .jar and /lib in a Program Files directory, and creating a shortcut on the desktop. My client even said he doesn't like the Java-cup default .jar icon. =) But I have more pressing matters than that right now, so I will revisit that, heh.

    Thanks again.
  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    rwilson352 wrote:
    ...Is there a "CLASSPATH" resource within the program that it looks to when you say
    Class.forName("org.firebirdsql.jdbc.FBDriver").newInstance();
    ?
    Yes. It is generally known as the run-time class-path of the application.
  • User_64CKJ
    User_64CKJ Member Posts: 7,279 Silver Badge
    Although I'd love to just hand them a stupid single .jar file that they can double click and run by itself... a tag-along "must be there or else" /lib folder is an acceptable solution. Problem solved.
    How about giving them a single smart URL to a web page that checks they have the right minumim Java to launch your application, then presents them with a single link to (install &) launch the app.? That last bit can be done using [Java Web Start|http://java.sun.com/javase/technologies/desktop/javawebstart/index.jsp], while the first part can be done by using [deployJava.js|http://java.sun.com/javase/6/docs/technotes/guides/jweb/deployment_advice.html].
  • darrylburke
    darrylburke Member Posts: 18,007
    But, what's more important than how and what the Class.forName method does, is where exactly is it looking for the org.firebirdsql.jdbc.FBDriver?? I know it's looking in the Jaybird JDBC driver .jar file, but how does it know where to find it? Is it looking at Environment Variables? Did Netbeans tell it where to look? Etc.
    [http://java.sun.com/docs/books/tutorial/deployment/jar/downman.html]

    Better, go through the whole trail, starting from [http://java.sun.com/docs/books/tutorial/deployment/jar/index.html]

    Then open up the jar file NetBeans generated and take a look at the contents of the manifest. You'll find it in the META-INF folder.

    db
This discussion has been closed.