6 Replies Latest reply: Feb 1, 2010 1:49 PM by jschellSomeoneStoleMyAlias RSS

    Compiling a driver within a program?

    843810
      Hello,

      I am having a problem, hopefully someone can help.

      I am writing a program that interacts with a Firebird database that is located on a remote server machine at my client's site.

      The program (obviously) requires a JDBC driver to be installed in order for it to work. On my developer machine, I obviously have the driver installed (and thus the program runs fine on my computer). The driver itself has no installer, it is simply a .jar file that needs to be pointed to by the environment variables. However, I do not want the user to have to change their environment variables in order to get my program to run (sorry, but asking a non-computer person to change their environment variables is asking for trouble, imo).

      Is there any way to "wrap" the driver within the .jar executable that I intend to distribute? I have looked online, but I'm pretty sure I'm lacking the proper vocabulary to describe my issue well enough for google to help.

      My end-goal is to distribute a single .jar executable that is immediately runnable, with no installation required (except Java, of course). However, if the best solution is to force the user to execute an installer, that would suffice. However, I haven't the slightest clue how to begin tackling that problem either. Something tells me it might be a bit overkill to require an installation though.

      Any suggestions, please feel free. I'm open to anything.

      Thank you.
        • 1. Re: Compiling a driver within a program?
          EJP
          Environment variables? Don't you mean system properties? in which case just set them in your code.
          • 2. Re: Compiling a driver within a program?
            843810
            >

            My end-goal is to distribute a single .jar executable that is immediately runnable, with no installation required (except Java, of course). However, if the >bes...
            >
            You can merger two jar files into one using this command


            jar cf myFile.jar *.jar
            one is ur actual code and the other is ur driver. And then distribute myFile.jar

            May be this could solve ur problem.
            • 3. Re: Compiling a driver within a program?
              EJP
              May be this could solve ur problem.
              Or maybe not. Have you actually tried it? or are you just guessing?
              • 4. Re: Compiling a driver within a program?
                jschellSomeoneStoleMyAlias
                rwilson352 wrote:
                The program (obviously) requires a JDBC driver to be installed in order for it to work. On my developer machine, I obviously have the driver installed (and thus the program runs fine on my computer). The driver itself has no installer, it is simply a .jar file that needs to be pointed to by the environment variables. However, I do not want the user to have to change their environment variables in order to get my program to run (sorry, but asking a non-computer person to change their environment variables is asking for trouble, imo).
                Are they going to use your database? Because if your users are not smart enough to set up a env var then there is absolutely no way they are going to set up a database.

                Say they do use your database - how do they access it? Via the internet? It is certainly possible to make a database secure from the internet. But it is so difficult that I would certainly never try it. And there are probably very few people in the world that I would trust to be able to do so.
                Is there any way to "wrap" the driver within the .jar executable that I intend to distribute? I have looked online, but I'm pretty sure I'm lacking the proper vocabulary to describe my issue well enough for google to help.
                Yes. You must create the manifest so it references the driver. Many threads have discussed it on the JDBC forum. Following keywords in google seemed promising to me.

                executable jar jdbc driver manifest
                • 5. Re: Compiling a driver within a program?
                  843810
                  Sorry if I wasn't clear.

                  It is not -my- database. The database is an underlying database to an off-the-shelf inventory management software package. The database is sitting on a server machine they have on their local network domain. The program I am building is intended to READ the database as-is, only, from any client desktop machine on the domain. I cannot change the database in any way.

                  The users are not setting up a database, the database is already in existence and currently interacts with the inventory management software control panel (a program on each client desktop).

                  Anyway, I have solved the problem. It seems Netbeans was taking care of the problem all along, I just needed to include the "/lib" folder from the /dist folder that it makes when you clean and build the project. The manifest, as you mentioned, references that folder.

                  And, for future reference... It's not about "are they smart enough" to set up an environment variable, but that I have never ever ever had to do such a thing for any software other than development-oriented software (JDK, JDBC drivers, etc), and it just makes me look incompetent and unable if I force the user to do a very complex installation for such a small program. They are not software people and the essence of abstraction is to keep the user focused on relevant tasks and information. The appearance of professionalism and intelligence is crucial to keeping the work coming in my direction.
                  • 6. Re: Compiling a driver within a program?
                    jschellSomeoneStoleMyAlias
                    rwilson352 wrote:
                    And, for future reference... It's not about "are they smart enough" to set up an environment variable, but that I have never ever ever had to do such a thing for any software other than development-oriented software (JDK, JDBC drivers, etc), and it just makes me look incompetent and unable if I force the user to do a very complex installation for such a small program. They are not software people and the essence of abstraction is to keep the user focused on relevant tasks and information. The appearance of professionalism and intelligence is crucial to keeping the work coming in my direction.
                    Then learn about installers.