Java Environment Building Series: JDK environment variable detailed configuration

Source: Internet
Author: User

Learning the Java language, writing Java programs, running Java programs, all without the support of the Java environment, the most important thing is to install jdk,jdk to provide me with the Java Program development environment and operating environment. In order for the Java program to be executed anywhere on the computer, the JDK configuration environment variable can solve the problem. The JDK typically needs to configure three environment variables Java_home,home and classpath. Let me say a few words about the configuration of these three environment variables.

  ☆ Preparation Work

①, make sure you have the right JDK for your computer (the JDK and computer system are the same number of bits)

②, know how to open DOS (Note: Window logo key +r key, enter cmd, and then enter)

③, know where the JDK is installed on your computer (the folder location installed on your computer)

  ☆ Open environment variable

Find "This computer" on the desktop (Win7 is a computer), then select the icon right-click, pop Up a menu, select Properties in this menu, click "Properties" this menu item.

The Pop-up window displays information about the current computer system, and when you see "Advanced system Settings" on the left, click on it.

In this pop-up window, click on the "Advanced" tab and see the bottom of the "environment variable" as shown below (some computers do not need to click Advanced, the default is on this page). The environment variable can be configured by clicking the ② environment variable button.

  ☆☆☆ Description:

The following are two sections, we generally choose the following system variable configuration, rather than select the above user variable configuration.

The "XXX user variable" above refers to when the logged-on user, the configured environment variable is limited to the current user's use.

The "System variables" below refer to the environment variable provided by the Super Super Administrator user, which configures the environment variables that any user can use. (Please note, click on the bottom of the new, edit button, not the middle)

  ☆ Configure Environment variables

①, configuring environment variables Java_home

Turn on this computer and find your JDK installation location. Copy the path above.

Because, Java_home, the value of this environment variable needs to know where the JDK is installed on the computer. So, here we have to copy this path first.

Click on the "New" button below the system variable to enter Java_home in the variable name, and the contents of the variable value will be pasted to the address just copied. With good information:

Click "OK".

②, configuring Path

Path environment variables exist, some applications and system programs need the support of this environment variable, so the value of path is originally content, configuration, do not delete. (You can copy the values and save them in a notepad.) If there is a problem with the configuration, you can paste the contents of the Notepad back in.

Locate the path item in the System Variables option, and then click the Edit button below. See as shown

You can toggle the display by clicking the "Edit Text" button at the bottom.

As shown, this is the style seen in other systems such as Win7 and WinXP.

At this point, in the text box after the variable value, your mouse can click anywhere, then press "Home" (jump to the front) or "End" (jump to the last face) on the keyboard, and I'll press the home key to jump to the front.

then enter "%java_home%\bin;" at the top, and note that this refers to the% of Java_home, which represents a reference to the Java_home variable value (path), and then accesses the contents of the Bin folder under that directory. Another note is the semicolon (here in English)

Click "OK"

  ③, configuring Classpath

Classpath refers to the introduction of the JDK's tool classes and common classes, which are simple to configure from the jdk1.7.

Click the "New" button under "System Variables", enter CLASSPATH in the variable name, enter the variable value.;( A dot and a semicolon, all in English), as shown in the configuration information

Click on the "OK" button and you can.

At this point, the environment variable configuration is complete.

  ☆ Important Notes

①, if the installed JDK version is lower (before 1.6 1.5,1.4,1.3,1.2), then the configuration of the environment variable classpath should be configured as follows:

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

Please note the dot and semicolon for the above notation.

②, the environment variable name and variable value, and DOS commands must be kept in English state input, cannot be entered in the Chinese state.

Chinese input status,

English input status

③, after configuring the environment variables, when compiling and running the Java program, enter the command and file name directly, do not need to enter the path.

Note: DOS location should go into the directory where the Java program is located (the directory where the Helloworld.java files are located)

Technology sharing: www.kaige123.com

Java Environment Building Series: JDK environment variable detailed 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.