Explanation of system environment variables

Source: Internet
Author: User

Installing the JDK requires setting the system environment variables, including the Java_home,classpath,path, where Java_home is the path to install the JDK, mainly for the convenience of writing the path later, with no real meaning. Path is set to the paths of common Java tools, including Java,javac (in .../bin), which is primarily convenient for each time we use this tool, we do not need to write out the full pathname of the tool. Classpath is the path that needs to be searched when executing the. class file with the Java command, which is where to find the. class file that we need to execute. Here is an example to illustrate classpath.

I created a new folder on my desktop test, which contains SRC and class two folders, where SRC is used to store the. java files we write, and class is used to store the compiled. class file.

Test |_SRC |_class

  When you write down Improt java.util.*, when the compiler faces the import keyword, you know you want to introduce java.util the class in the package, but how does the compiler know where you put the package? So you first have to tell the compiler where the package is located, and how do you tell it? is set classpath) if java.util this package in C:\jdk\ directory, you have to set c:\jdk\ this path to Classpath! When the compiler faces the import java.util.* this statement, it first looks for the directory specified by Classpath and checks to see if the subdirectory java\util exists, and then finds the compiled file (. class file) that matches the name. If you do not find it will be an error!

After reading the above introduction, I think we should understand the role of environmental variables, you will know why it is necessary to configure, rather than only know the need to configure.

Explanation of system environment variables

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.