• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

mysql connector classpath problem on unix

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
 
Marshal
Posts: 28193
95
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • 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
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
thx a lot for your fast and good answer. It's working now
 
reply
    Bookmark Topic Watch Topic
  • New Topic