I am trying to use adit in my local environment.
I copied the files to:
/Users/koraytugay/adit-0.93
I go to terminal and type:
export CLASSPATH=$CLASSPATH:/Users/koraytugay/adit-0.93/mysql-connector-java-5.1.33.jar
I am sure that .jar file is there.
Then I type:
Korays-MacBook-Pro:adit-0.93 koraytugay$ java -jar adit.jar
However I am constantly getting:
Attempting to load the driver: com.mysql.jdbc.Driver
Driver not found
SQL Exeception: No suitable driver found for jdbc:mysql://localhost/ebtam
What am I doing wrong?
When you use -jar
, the CLASSPATH
environment variable is ignored.
The simplest approach here would probably be to use:
java -cp adit.jar:/Users/koraytugay/adit-0.93/mysql-connector-java-5.1.33.jar foo.bar.MyMainClass
Alternatively, you can specify relative classpath entries to a jar file via the manifest. So you could have:
Class-Path: mysql-connector-java-5.1.33.jar
in the manifest, and copy that jar file into the same directory as adit.jar
, then you should be able to use -jar
.
See more on this question at Stackoverflow