1.4.2 Setting the PATH environment variable

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.