LWJGL使用“java”时找不到类错误命令
我使用此命令成功编译了我的源代码:
javac -classpath "..\lwjgl-2.7.1\jar\lwjgl.jar" Game.java
但是,当我尝试使用: 运行它时
java -classpath "..\lwjgl-2.7.1\jar\lwjgl.jar" Game
,它给了我一个错误:
Error: Could not find or load main class Game
我做错了什么!? :(
我确信不存在语法错误和类标签异常。
编辑:我也尝试使用此命令运行程序,但仍然没有任何结果。TT
java -cp "..\lwjgl-2.7.1\jar\lwjgl.jar" -Djava.library.path="..\lwjgl-2.7.1\native\windows" Game
I successfully compiled my source using this command:
javac -classpath "..\lwjgl-2.7.1\jar\lwjgl.jar" Game.java
However, when I try to run it using:
java -classpath "..\lwjgl-2.7.1\jar\lwjgl.jar" Game
, it gives me an error:
Error: Could not find or load main class Game
What have I done wrong!? :(
I am certain that there are no syntactical errors and class labeling anomalies.
EDIT: I've also tried running the program using this command, but still nothing. T.T
java -cp "..\lwjgl-2.7.1\jar\lwjgl.jar" -Djava.library.path="..\lwjgl-2.7.1\native\windows" Game
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
在我坐在马桶上无数个小时之后,这就是答案...
请注意 -cp 后面的分号。分号。这就是我所缺乏的。一个该死的分号。
我希望没有人犯我所犯的错误。
Here is the answer, after endless hours of sitting on my toilet...
Note the semi-colon after the -cp. The SEMI-COLON. That was all that I was lacking. A FRIGGIN' SEMI-COLON.
I hope nobody commits the mistake I did.
它必须是
It has to be
Game.class 是否在该 jar 文件内?如果没有,您可能还需要包含类文件的路径。对于当前工作目录,请尝试:(
也许 : 在 Windows 上应该是 ; )。
Is
Game.class
inside of that jar file? If not, you probably need to include the path to the class file as well. For the current working directory, try:(Maybe that : should be a ; on Windows).