Reputation: 129
I have a java program which I want to run on Mac os.
I have problem in setting classpath of jre and mysql.jar.
If I set classpath for 'mysql-connector-1.15.0-bin.jar', its displaying exception of 'undefined method - main'
and if I set classpath for 'jre', its displaying 'ClassNotFoundException - com.mysql.jdbc.Driver' .
Please help how to set both classpath at a time.
Upvotes: 4
Views: 857
Reputation: 205785
You can also specify the classpath in your JAR's manifest. It should work on Mac OS or Windows.
Class-Path: mysql-connector-1.15.0-bin.jar Main-Class: your.Program
Upvotes: 2
Reputation: 308753
classpath has to all the .class files that your application needs, including the ones you write. Put the MySQL JDBC JAR and the path to your main class into classpath using the -classpath
option on javac.exe and java.exe.
Upvotes: 2