开发者

Problem on setting classpath of mysql.jar with java program on Mac os

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 c开发者_开发技巧lasspath at a time.


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.


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
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜