Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
如果源文件引用第三方库(jar)文件,请使用-CP选项,并指定jar file。例如:
jar
-CP
javac -cp lib\mysql-connector-java-8.0.27.jar -d classes src\TestDb.java
如果有多个jar文件,则必须由Semicolon隔开:
javac -cp lib\mysql-connector-java-8.0.27.jar;lib\log4j-1.2.17.jar -d classes src\TestDb.java
In case the source files reference third-party library (JAR) files, use the -cp option and specify the JAR file. For example:
JAR
-cp
If there are multiple JAR files, they must be separated by semicolon like this:
您不能简单地通过javac xxx.java来编译源文件,因为您的代码有依赖性。
javac xxx.java
检查: https://stackoverflow.com/a/a/9091749/13068918
You cannot simply compile the source file via javac xxx.java since you have a dependency in your code.
Check: https://stackoverflow.com/a/9091749/13068918
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
暂无简介
文章 0 评论 0
接受
发布评论
评论(2)
如果源文件引用第三方库(
jar
)文件,请使用-CP
选项,并指定jar
file。例如:如果有多个
jar
文件,则必须由Semicolon隔开:In case the source files reference third-party library (
JAR
) files, use the-cp
option and specify theJAR
file. For example:If there are multiple
JAR
files, they must be separated by semicolon like this:您不能简单地通过
javac xxx.java
来编译源文件,因为您的代码有依赖性。检查: https://stackoverflow.com/a/a/9091749/13068918
You cannot simply compile the source file via
javac xxx.java
since you have a dependency in your code.Check: https://stackoverflow.com/a/9091749/13068918