Java Development environment-environment variables and configuration

Source: Internet
Author: User

What is a JDK? What is a JRE?

JRE (Java Runtime Environment): Java Runtime Environment;

JDK (Java Development Kit): Java SDK, which already contains JRE;

What environment variables do Java require, and what are the effects of these environment variables?
    1. java_home variable , is the root directory of the JDK, the following path and Classpath will refer to it, using this kind of reference, there is a benefit, that is, if the JDK changed position, directly modify the Java_home variable.
    2. The path variable , bin is the main program directory of the JDK, add it to the path variable, in order to let the system in the non-JDK bin directory can also open the Bin directory of the program, you can compile and run the Java file in any directory, otherwise, The Java source code must be placed in the bin directory each time the compilation is run.
    3. The classpath variable is used to search for classes at compile and run time, note that the previous point cannot be omitted, that is, the current directory, that is, when searching for a class, the current directory of the source code is searched first.

Environment variable Configuration

The previous job is to download the JDK on the Oracle website without repeating it. After the installation is complete, open the Advanced system settings and configure the environment variables.

method One: Has the configuration java_home, uses the reference way

As has been said before: " using this kind of reference, there is a benefit, that is, if the JDK changed position, directly modify the Java_home variable." "

The first step:

Add a new system variable java_home, the value of which is the JDK's installation path:

C:\Program Files (x86) \java\jdk1.8.0_91

Step Two:

To modify an existing system variable: Path, add:

%java_home%\bin;

Step Three:

To add a new system variable classpath, you need to configure Tools.jar,dt.jar with the value:

.; %java_home%\lib\dt.jar;%java_home%\lib\tools.jar;

method Two: Do not configure Java_home, you want to use absolute path

The first step:

Configure the path variable, select the installation directory for the JDK8, and enter the value of the variable:

; C:\Program Files (x86) \java\jdk1.8.0_91\bin

Step Two:

Configuring the CLASSPATH variable requires configuring Tools.jar,dt.jar, and the input variable value is:

.; C:\Program Files (x86) \java\jdk1.8.0_91\lib\tools.jar; C:\Program Files (x86) \java\jdk1.8.0_91\lib\dt.jar

Test

Input in cmd: Javac, the following result appears, the configuration is successful.

Java Development environment-environment variables and configuration

Related Article

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.