Introduction to Java First quarter 1-2 Java environment Building

Source: Internet
Author: User

1. Installing the JDK

Official website Download jdk:www.oracle.com/technetwork/java/javase/downloads

Download the corresponding JDK

2. Configure Environment variables

Java environment Variables Java_home, CLASSPATH, path settings detailed

There are 3 main environment variables used in JAVA under Windows, Java_home, CLASSPATH, and PATH.

Java_home points to the installation path of the JDK, such as C:\jdk1.5.0_06, you should be able to find the bin, Lib and other directories under this path.

(Tonight with the new system configuration, do not know how to add bin to run in Cmd, Java_home=c:\jdk1.5.0_06\bin; The following is the online finishing practice can be used, note that the JDK and eclipse must be the same bit bits to use, Can not be a different number of programs, has been practice, or to error can not be used; If you need to uninstall JDK,JDK can not directly delete the folder, to use the uninstall method, or can no longer use the JDK or can not uninstall, only reinstall the OS to use, previously encountered)

Java_home=c:\jdk1.5.0_06

The path environment variable is already in Windows, you just have to modify it to point to the JDK Bin directory, so you do not need to type a large string of paths when compiling and executing the program under the console. The Setup method is to preserve the contents of the original path and add the%java_home%\bin

(Note, if you do not understand DOS batch processing, you may not understand what is meant by the content of the percent of the java_home, in fact, this is a reference to the previous set of environment variables, you can write x:\JDK_1.4.2 is also possible; you can open a console window and enter the Echo%java _home% look at your setup results)

path=%java_home%\bin;%path%


Again,%path% is referencing the PATH environment variable you set earlier, and you can copy the previous value.

CLASSPATH Environment variables I put in the last side, because you appear in the inexplicable strange problem 80% or more may be due to the CLASSPATH settings are not caused, so be more careful.


Classpath=.; %java_home%\lib;%java_home%\lib\tools.jar


The first thing to note is the front ".;", if you can't see clearly, I'll read it to you-a period semicolon. This is to tell the JDK to search the class for the current directory's class file-why, this is due to the security mechanism of Linux, Linux users understand that the Windows users are very difficult to understand (because the Windows default search order is the first to search the current directory , then search the system directory, and then search for the PATH environment variable set).
Why is Tools.jar this specific file specified later in classpath? Don't specify a line? Obviously not, I can still do that. :) This is determined by the import mechanism and jar mechanism of the Java language, and you can check the data to resolve it.


Specific settings: Right-click My Computer, Properties----Advanced environment variables, modify the value of the box below the system variable is OK.

The user modifies the txt text attribute auto.bat file and joins it at the end:

Set java_home=c:\jdk1.5.0_06
Set path=%java_home%\bin;%path%
Set classpath=.; %java_home%\lib;%java_home%\lib\tools.jar

Introduction to Java First quarter 1-2 Java environment Building

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.