Installation of JDK and environment variable configuration in Windows environment

Source: Internet
Author: User
Tags java se

First, the Preparation tool:

1.JDK
JDK can be downloaded from the website
Http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html
2. System
This is WINDOWS7 64 system.


The corresponding JDK can be downloaded according to the version of the system.

I choose here: Jdk-8u25-windows-x64.exe


Note the distinction:

Java SE Development Kit 8U25
Java SE Development Kit 8u25 Demos and Samples Downloads
JavaFX Demos and Samples Downloads


The first Java SE Development package
Second Java SE development package + example
A third JavaFX development kit and example

The first is the one that must be configured for the Java development environment


Ii. Methods/Steps

1. Install JDK,JRE, select the installation directory
There are two installation prompts during installation. The first time is to install the JDK, and the second is to install the JRE. It is recommended that all two are installed in a different folder in the same Java folder. (cannot be installed in the Java folder root directory, JDK and JRE installed in the same folder will be error).
(1) Double-click Jdk-8u25-windows-x64.exe to install.

(2) Click "Next" to continue.

(3) Select the installation path and click Next.
The default is on the C drive. I chose the D-plate here. Path is: D:\Java\jdk1.8.0_25\

(4) Wait for the installation to finish. Select the path to the JRE installation and click Next.
C drive is selected by default.

Wait for the installation to complete.


(5) Installation of the JRE


(6) I choose the D-plate here. When you select the change, first create a folder in the hard disk. Because it does not give new at the time of the selection. I am here to build a: Jre1.8.0_25 folder.

(7) When the installation is complete, click Close.

2. Configuring the System environment

Configure environment variables: Right-click "My Computer"-"advanced"-"Environment variables".

(1) Java_home environment variables.
Role: It points to the JDK's installation directory, and Eclipse/netbeans/tomcat software is to find and use the installed JDK by searching for java_home variables.
Configuration method: In the system variable click New, variable name fill java_home, variable value to fill the JDK installation path. (Fill in according to your own installation path)

Java_home:d:\java\jdk1.8.0_25

(2) Classpath environment variables.
Role: is to specify the class search path, to use the already written classes, the premise is to be able to find them, the JVM is through the classpth to find the class. We need to set the Dt.jar and Tools.jar in the Lib subdirectory of the JDK installation directory to classpath, of course, the current directory "." must also be added to the variable.
Configuration method:
Create a new classpath variable with a variable value of:.; %java_home%\lib;%java_home%\lib\tools.jar. Classpath variable name, can be uppercase or lowercase. Be careful not to forget the front dot and the middle semicolon. And a semicolon and a comma to enter in the English state.

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

(3) PATH environment variable

Function: Specifies the command search path, executes the command under the I command line as Javac compiles the Java program, it looks in the path specified by the path variable to see if the appropriate command program can be found. We need to add the bin directory in the JDK installation directory to the existing path variable, and the bin directory contains the frequently used executables such as Javac/java/javadoc wait, and after setting the path variable, you can execute the Javac/java tool in any directory.

Find the path variable in the system variable, which is the system's own, not new. Double-click Path, because the original variable value already exists, it should be added ";%java_home%\bin;%java_home%\jre\bin" after the existing variable. Note the preceding semicolon.

Path:;%java_home%\bin;%java_home%\jre\bin

Then click OK to finish.


Third, the test environment.

Verify that the configuration runs CMD successfully, enter Java,javac separately, java-version (there are spaces between Java and-version).

1.Java


2.Javac


3.java–version


If the version information is displayed, the installation and configuration are successful.

Summary:
Environment variables:
Java_home:d:\java\jdk1.8.0_25
CLASSPATH:.; %java_home%\lib;%java_home%\lib\dt.jar;%java_home%\lib\tools.jar;
Path:;%java_home%\bin;%java_home%\jre\bin

Test:
Java,javac,java–version

Original Daliu_it
Blog Source: http://www.cnblogs.com/liuhongfeng/p/4177568.html

The copyright of this article is owned by the author and the blog Park, but reproduced without the consent of the author must retain the above statement and placed in the article page obvious location. Thank you for your cooperation.

Installation of JDK and environment variable configuration in Windows environment

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.