The following error occurs during Java compilation on the console:
Exception in thread "Main" Java. Lang. noclassdeffounderror: qpp12_1
Caused by: Java. Lang. classnotfoundexception: qpp12_1
At java.net. urlclassloader $ 1.run( unknown source)
At java. Security. accesscontroller. doprivileged (native method)
At java.net. urlclassloader. findclass (unknown source)
At java. Lang. classloader. loadclass (unknown source)
At sun. Misc. launcher $ appclassloader. loadclass (unknown source)
At java. Lang. classloader. loadclass (unknown source)
Cocould not find the main class: qpp12_1. program will exit.
Solution:
1. Set environment variables.
Right-click my computer> Properties> advanced> environment variables> system variables> path> double-click,
Add a semicolon at the end, and paste the Java installation directory to it. For example:
C:/program files/Java/jdk1.6.0 _ 19/bin
Note:
If the PATH variable cannot be found in the "environment variables" window, click "new" in the "System variables" field to create a new one.
2. Set classpath
Right-click my computer> Properties> advanced> environment variables> system variables,
Then create a new classpath. The variable value is the directory where your *. Class file is located. My Java file and *. Class are stored in the javaprj directory of drive F.
Therefore, set the value of classpath to F:/javaprj.
Then you can test it in the console window, enter Java, and press enter to display some detailed information. Everything is OK.