jdbc driver and jar problem

L

Liz

Is there something special about jdbc drivers
and jar files? My app runs fine using MySQL.
The MySQL jar file is in my classpath. When
I put the app into a jar file, I keep getting
class not defined; it can't find the driver.
Even if I put the MySQL jar file in the current
directory it can't find it.
 
M

Michael Rauscher

Liz said:
Is there something special about jdbc drivers
and jar files? My app runs fine using MySQL.
The MySQL jar file is in my classpath. When
I put the app into a jar file, I keep getting
class not defined; it can't find the driver.
Even if I put the MySQL jar file in the current
directory it can't find it.
try

java -cp \path\to\mysql.jar;\path\to\my.jar package.of.MainClass
or
java -cp /path/to/mysql.jar:/path/to/my.jar package.of.MainClass

or write a Class-Path attribute into your jar's manifest.

Bye
Michael
 
F

Filip Larsen

Liz wrote
Is there something special about jdbc drivers
and jar files? My app runs fine using MySQL.
The MySQL jar file is in my classpath. When
I put the app into a jar file, I keep getting
class not defined; it can't find the driver.

Note that if you start your application using the -jar command line
option then all the class path options are ignore and only those found
in the manifest file of the jar is used.


Regards,
 
L

Liz

Filip Larsen said:
Liz wrote


Note that if you start your application using the -jar command line
option then all the class path options are ignore and only those found
in the manifest file of the jar is used.


Regards,
Yes that does it, thanks.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,769
Messages
2,569,580
Members
45,055
Latest member
SlimSparkKetoACVReview

Latest Threads

Top