Configuration of environment variables:
1): Permanent configuration mode:java_home=% installation path%\JAVA\JDK
Path=%java_home%\bin
2): Temporary configuration mode:set path=%path%; C:\Program Files\java\jdk\bin
Features: The system defaults to the current path to find the program to execute, if not, then go to the path set in the paths to find.
Configuration of the classpath:
1): Permanent configuration mode:classpath=.; C:\;e:\
2): Temporary configuration mode:set classpath=.; C:\;e:\
Note: What you need to be aware of when defining classpath Environment variables
If you do not define an environment variable Classpath,java starts the JVM, it looks for the class file to run under the current directory;
if classpath is specified, the class file to be run is looked up under the specified directory.
Will you find it in the current directory? Two cases:
1): If there is a semicolon at the end of the Classpath value, the running class is not found in the specific path, and will be found again by default in the current directory.
2): If the value of classpath results in no semicolon, the running class is not found in the specific path and is no longer found in the current directory.
generally do not specify a semicolon , if not found in the specified directory to run the class file, the error, so you can debug the program.
What do 4,javac commands and Java commands do?
you know that Java is divided into two parts: one is compile, one is run.
Javac: is responsible for the compilation of the part, when executing javac, will start the Java compiler program. Compiles a. java file with the specified extension. Generates bytecode files that the JVM can recognize. This is the class file, which is Java's running program.
Java: the part that is responsible for the run . The JVM is started. Then load the class library that is required by the runtime and execute it.
a file to be executed must have a starting point for execution, and this starting point is the main function.
5, Virtual machine
when I do software reviews in a virtual machine, it can crash like a system, but it crashes just the operating system on the virtual machine, not the operating system on the physical computer, and with the Undo feature of the virtual machine, I can immediately restore the virtual machine to the state before the software was installed.
Java classpath role