I persistently use command lines to compile and run java programs, so I encountered some problems, but the result was to clarify the essence of the java CALSSPATH environment variables. Although IDE is convenient, command line solves the essence of the computer. After you get started and become proficient, command line will only bring you a higher efficiency and sense of accomplishment. When java needs to outsource the jar package and run a class file that is not in the current directory, the CALSSPATH environment variable must be correctly set to work properly. In fact, the principle is quite simple. I just need to google it and I will find a lot of people who are confused and wrong like me. Some of them must be familiar with the java language and library, it was just a sudden change in the environment that suddenly failed to work and did not know how to solve the problem. In fact, the CLASSPATH environment variable provides a directory prefix for java, which is the same as the current prefix provided by PATH to shell. Java does not know where you put the jar package, so you need to set the jar directory to CLASSPATH. If your project is not a directory like HelloWorld, and the class file is directly in the local directory, you also need to set your project directory to CLASSPATH. Otherwise, when you try to run the class, java will not be able to find it, and an error such as "Exception in thread" main "java. lang. NoClassDefFoundError" will appear. In fact, this error also occurs when you randomly type a java xxx on the command line. One sentence is the directory where the package is located and the directory inside the package. Pay special attention to the issue of "/" when connecting two directories.