LWJGL cannot find class error when using "java <class file>" command
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
Here is the answer, after endless hours of sitting on my toilet...
java -cp "..\lwjgl-2.7.1\jar\lwjgl.jar"; -Djava.library.path="..\lwjgl-2.7.1\native\windows" Game
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
java -classpath "..\lwjgl-2.7.1\jar\lwjgl.jar" Game
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:
java -classpath "../lwjgl-2.7.1/jar/lwjgl.jar:." Game
(Maybe that : should be a ; on Windows).
精彩评论