As mentioned earlier, compiling and running a Java program must go through two steps.
1. Compile the source file into byte code.
2. Explain the implementation of platform-independent bytecode programs.
The above two steps require the use of Java and javac two commands respectively. Start the Windows operating system command-line window (run the cmd command in the Start menu), enter the Java and JAVAC commands in the Command Line window, and you will see the following output:
C:\users\administrator>java ' Java ' is not an internal or external command, nor is it a running program or batch file. C:\users\administrator>javac ' Javac ' is not an internal or external command, nor is it a program or batch file that can be run.
This means that we are not yet able to use Java and javac two commands. This is because: although we have installed the JDK in the computer, and the JDK installation path also contains Java and javac two commands, but the computer does not know where to find the two commands.
How does the computer find the command? The Windows operating system looks for commands based on the PATH environment variable. The value of the PATH environment variable is a series of paths that the Windows operating system will look for in the sequence of paths, which can be executed if the command is found, or "' XXX ' is not an internal or external command, or a program or batch file that can be run," The Linnux operating system looks for the command according to the PATH environment variable, and the value of the PATH environment variable is also some column path. Because the Windows operating system is case-insensitive, there is no difference between setting path and path, and the Linux system is case-sensitive, and setting path and path is different, so you only need to set the PATH environment variable.
Tip: Whether it's a Linux platform or a Windows platform, you can compile and run Java programs by simply adding the paths to the PATH environment variable where the Java and Javac two commands are located.
1.4.2 Setting the PATH environment variable