include postgreSQL driver to my JAR file

Hi!

I have some files I want packaged into a JAR. one of them uses a postgreSQL driver to access database. However I can't start my JAR file.

I've previously made another JAR file and got it to work (similarities to the one below) but without a database driver...

location of .class files

ProjectName/build/classes/

location of driver:

ProjectName/build/classes/

I've run this command without luck

-

cd C:\Prog\Java\ProjectName\build\classes\

C:\Apps\Java\jdk1.6.0\bin\jar cfe AppServer.jar server.Server server\* db\* graphic\* network\* postgresql-8.2-505.jdbc4.jar

-

Where should I place the driver? in which catalog?

What commands do I use (I prefer not using manifest files if possible..)

thx..

Message was edited by:

CbbLe

[836 byte] By [CbbLea] at [2007-11-27 6:58:28]
# 1
I am confused... are you receiving an error when trying to use your JDBC driver or are you wanting to execute your AppServer.jar starting at the main method?
maple_shafta at 2007-7-12 18:49:06 > top of Java-index,Desktop,Deploying...
# 2
I want to be able to execute my AppServer.jar starting at the main method.After I have tried making JAR file with the command I described above. I get a JAR file but when I double-click it. No screen is coming up or anything...
CbbLea at 2007-7-12 18:49:06 > top of Java-index,Desktop,Deploying...
# 3

Why do you prefer not to use Manifest files? I don't see any business or technical reason why you shouldn't, especially since that is the only way to execute a JAR file in the way that you are attempting.

If you are that against using Manifest files then the only other thing I can suggest is to write a small batch or shell script file that adds the JAR to your classpath and calls the Main class.

maple_shafta at 2007-7-12 18:49:06 > top of Java-index,Desktop,Deploying...
# 4
dunno, never liked them, but ok :Pok, I got a working JAR file now which is netbeans autogenerated one. However, netbeans creates a JAR file AND a lib\ folder where the postgreSQL driver is. Is there a way to include this to the JAR file so I have only 1 file?
CbbLea at 2007-7-12 18:49:06 > top of Java-index,Desktop,Deploying...
# 5
Unfortunately no.You can't include a JAR within a JAR.Well... you CAN include a JAR within a JAR, however the class files within the inner JAR file will never be visible on the classpath.
maple_shafta at 2007-7-12 18:49:06 > top of Java-index,Desktop,Deploying...
# 6
As maple said, the classes inside the jars-within-a-jar won't be loadable. You can use a custom classloader to get hold of them, but why bother? All this coupling together dependencies is a bad idea
georgemca at 2007-7-12 18:49:06 > top of Java-index,Desktop,Deploying...