Java environment variable Configuration

Source: Internet
Author: User

Set Java_home:

One is to facilitate the reference, for example, the JDK installed in the C:\jdk1.6.0 directory, then set Java_home as the directory path, then to use this path later, just enter%java_home%, to avoid each reference to enter a long path string;
The second is a principle, when the JDK path changes, only need to change the value of the java_home variable, otherwise, it is necessary to change any of the absolute path references to the JDK directory document, if there is no change, a program can not find the JDK, the consequences are imagined----system crashes!
Thirdly, third-party software will refer to the agreed-upon java_home variable, otherwise you cannot use the software normally.
New Java_home (Java_home points to the JDK's installation path) in the System environment variable column

Path variable

The path variable allows us to run Java applications anywhere in the system, such as Javac, Java, Javah, and so on, to find the directory where we install the JDK,
Assuming that our JDK is installed in the C:\jdk1.6.0 directory, then in the C:\jdk1.6.0\bin directory is our common Java application, we need to add C:\jdk1.6.0\bin this directory into the PATH environment variable.

Classpath variable

The CLASSPATH environment variable is when we need to refer to a class that someone else has written when developing a Java program, let the Java interpreter know where to look for the class. In general, Sun provides us with some extra rich class packages, one is Dt.jar, the other is Tools.jar, and these two jar packages are located in the C:\jdk1.6.0\lib directory, so we usually add these two jar packages to our CLASSPATH environment variable. Set classpath=.; C:\jdk1.6.0\lib\tools.jar; C:\jdk1.6.0\lib\dt.jar.
Note When you finish configuring the environment variable, type the command when you test whether the JDK is installed successfully: Java-version

Java environment variable Configuration

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.