• Post Reply Bookmark Topic Watch Topic
  • New Topic

mysql connector classpath problem on unix  RSS feed

 
Mike dem
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,
I know there are a lot of threads that talk about this subject, but i didn't find any solution to my problem.
I wrote a software that need the use of mysql connector but when i try run it on a unix computer i get the famous error

I tried java -cp pathToMysqlConnector/mysqlconnectorName.jar -jar myApp.jar
I tried java -cp ./mysqlconnectorName.jar -jar myApp.jar since the two jars are in the same folder.
I tried to copy my sqlconnector jar in jre/ext, jre/lib, ...
and still get that error.
I don't know what i do wrong, is there any special parameter to include jar file when executing my app ?

Plz hlp i become mad

thx in advance
 
Paul Clapham
Sheriff
Posts: 22819
43
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
If you use the "-jar" option in your command line, that means you are using an executable jar file. So in that case the "-cp" option is ignored. you should put a Class-Path entry in your jar file's manifest that refers to the MySQL driver jar file.

Or if you don't want to do that, then don't run it as an executable jar. Just run the main class from the jar file, while specifying both your jar file and the MySQL driver jar file in your classpath ("-cp") option.
 
Mike dem
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
thx a lot for your fast and good answer. It's working now
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!