Error executing Java program : Could not find or load main class
This question already has an answer here:
Your CLASSPATH isn't set (or isn't set correctly). From the Java tutorial,
The CLASSPATH variable is one way to tell applications, including the JDK tools, where to look for user classes.
However, you can also specify a CLASSPATH to the java runtime with the -cp
argument (also aliased to -classpath
. A colon separated list of folders, and jar/zip files to search for class files.
That's why
java -cp . HelloWorld
Allowed the JRE to find HelloWorld.class. You could also set CLASSPATH.
链接地址: http://www.djcxy.com/p/54980.html上一篇: 运行Java Spring应用程序