Java basics-environment variable configuration, java Basic Environment Variable

Source: Internet
Author: User

Java basics-environment variable configuration, java Basic Environment Variable

Java involves two system environment variables: path and classpath.

1. path Environment Variables

The path environment variable is a type of system environment variable. It is used to save a series of paths. Each path is separated by a semicolon. When you run an executable file in the command line window, the operating system first checks whether the file exists in the current directory, if the file does not exist, the file will be searched for in the path defined in the path environment variable. If the file is not found, the system reports an error.

Configure environment variables in Windows 7:

1. Right-click computer and select properties. The following page is displayed:

    

Figure 1

2. Click Advanced system settings. The following page is displayed:

    

Figure 2

3. Click environment variables. The following page is displayed:

    

Figure 3

4. Select the path system variable and click Edit. The following page is displayed:

    

Figure 4

5. Copy the bin folder path of your JDK installation directory, for example:

    

Figure 5

6. paste the complex bin path into the path value. Note that the English half-width symbol (;) is used at the end, for example:

    

Figure 6

Click OK, and click OK in Figure 3. Then, click Apply in Figure 2.

7. Check whether the environment variable configuration is successful. Enter javac in the command line.

 

Ii. classpath Environment Variables

The classpath environment variable is also used to save a series of paths. It and the path environment variable are viewed and configured in the same way. When the Java Virtual Machine needs to run a class, it will find the required class file in the path defined in the classpath environment variable.

From JDK5.0, if the classpath environment variable is not configured, the Java VM automatically sets it to ".", that is, the current directory. Therefore, classpath does not need to be configured.

 

    

 

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.