[英]Java command line error (could not find or load main class)
When attempting to run the below command: 尝试运行以下命令时:
java -classpath mycompanychecks.jar:checkstyle-5.7-all.jar \
com.puppycrawl.tools.checkstyle.Main \
-c config.xml -r .
I get the error: 我得到错误:
Error: Could not find or load main class \
In the directory that I'm running the command from I do have the two jar files, and also I have checked that ' com.puppycrawl.tools.checkstyle.Main
' does in fact reside in the ' checkstyle-5.7-all.jar
'. 在我从中运行命令的目录中,我确实有两个jar文件,并且我还检查了
com.puppycrawl.tools.checkstyle.Main
实际上是否驻留在checkstyle-5.7-all.jar
'。 As the error seems to refer to the backslash maybe it's a syntactical error? 由于错误似乎是指反斜杠,可能是语法错误? However I'm executing the command exactly as stated on the checkstyle page .
但是我完全按照checkstyle页面上的说明执行命令。
This example you're trying is clearly not about Windows. 您尝试的该示例显然与Windows不相关。
Check here: 在这里检查:
http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html http://docs.oracle.com/javase/7/docs/technotes/tools/windows/classpath.html
You need to use ;
您需要使用
;
as separator to say the least. 至少可以说是分隔符。
So you need something like this (this is all one line). 因此,您需要像这样的东西(全部都是一行)。
java -classpath c:\\test\\mycompanychecks.jar;c:\\test\\checkstyle-5.7-all.jar com.puppycrawl.tools.checkstyle.Main -c config.xml -r .
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.