Installation and configuration of Java jdk __java

Source: Internet
Author: User

Java Development and Android development all need to install JDK first



I. Installation of JDK

First go to the Java website Download jdk,http://www.oracle.com/technetwork/java/javase/downloads/index.html


Installation process is very simple, you can choose the default settings, directly click "Next" can be; the installation directory can be customized to the folder you want to install, but generally follow no space, no Chinese path and path as far as possible not too deep,

Here, the installation directory I chose is: C:\Java\JDK (JDK installation directory).


Two. After installing the JDK, the following is the configuration of "Java environment variables", and the configuration steps are as follows:

1. Right-click Computer, select Properties, and select Advanced system settings in the pop-up window.


2. In the pop-up System Properties window, under the Advanced tab, select Environment variables


3. In the Pop-up Environment Variables window, set 3 properties in the system variable (S), respectively: Java_home,path,classpath (regardless of case), if already exist, click "Edit", does not exist then click "New".


New system variable (java_home)

Variable name: java_home

Variable value:C:\Java\JDK (this directory is the path to the JDK installation, this path includes folders such as LIB,BIN,JRE)

Edit System variable (CLASSPATH), if there is no such variable, you need to create a new CLASSPATH Java Load Class (class or Lib) path, only the class in CLASSPATH, Java command to recognize

Variable name: CLASSPATH

Variable value:%java_home%\lib\dt.jar;%java_home%\lib\tools.jar; (note: The variable value is placed in the classpath; where the value of the variable is finally added ";")

Edit the system variable (path), and if it is not, create a new path thatallows the system to recognize Java commands under any of the paths.

Variable name: PATH

Variable value:.; %java_home%\bin; (Note: The value of the variable is placed in front of the existing path value, paying attention to the front point)


three. Test environment variable is configured successfully with the following steps

1. "Start"---> "Run" or "win+r", type "cmd";

2. Type the command "Java-version", "Java", "Javac", appear similar to the following screen, indicating the success of environment variable configuration.






=========================== Split Line ===============================


a brief introduction to three environment variables:

java_home: The value of this environment variable is the directory of Java, some Java software and some Java tools need to use this variable, set PATH and CLASSPATH, you can also use this variable for easy setting.

path: Specifies a list of paths to search for executable files. When executing an executable file, if the file cannot be found under the current path, then look for each path in the path until it is found. Or you cannot find the path in the paths you are looking for, an error occurs. The Java Compilation command (JAVAC), execution commands (Java), and some tool commands (Javadoc, JDB, etc.) are in the Bin directory under their installation path. So we should add it to the path variable.

CLASSPATH: also specifies a list of paths that are used to search for Java compilation or runtime classes that need to be used. In the CLASSPATH list, you can include the. jar file in addition to the path. Java Lookup classes will look at this. jar file as a directory. Typically, we need to include the Jre/lib/rt.jar (Linux:jre/lib/rt.jar) under the JDK installation path in CLASSPATH.

Both path and CLASSPATH specify a list of paths, separated by delimiters between the items in the list, that is, the individual paths. Under Windows, delimiters are semicolons (;), and in Linux, delimiters are colons (:).

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.