[英]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. 我有一个java程序,我想在Mac OS上运行。
I have problem in setting classpath of jre and mysql.jar. 我在设置jre和mysql.jar的类路径时遇到问题。
If I set classpath for 'mysql-connector-1.15.0-bin.jar', its displaying exception of 'undefined method - main' 如果我为'mysql-connector-1.15.0-bin.jar'设置类路径,则显示'undefined method-main'的异常
and if I set classpath for 'jre', its displaying 'ClassNotFoundException - com.mysql.jdbc.Driver' . 如果我为'jre'设置classpath,它会显示'ClassNotFoundException - com.mysql.jdbc.Driver'。
Please help how to set both classpath at a time. 请帮助一次设置两个类路径。
classpath has to all the .class files that your application needs, including the ones you write. classpath必须包含应用程序所需的所有.class文件,包括您编写的文件。 Put the MySQL JDBC JAR and the path to your main class into classpath using the
-classpath
option on javac.exe and java.exe. 使用javac.exe和java.exe上的
-classpath
选项将MySQL JDBC JAR和主类的路径放入classpath。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.