Configure JDK environment variables in Windows XP

Source: Internet
Author: User

1. Install JDK. You can customize the installation directory and other information during the installation process. For example, select c: \ jdk1.6 as the installation directory;

2. After the installation is complete, right-click "my computer" and click "properties ";

3. Select the "advanced" tab and click "environment variables ";

4. in "system variables" (some companies do not allow users to modify system variables themselves. In this case, you can also set Java environment variables in "User variables ), set three attributes: java_home, path, and classpath (case-insensitive). if it already exists, click Edit"(If the value contains content, separate it with a semicolon ),Click "new" if it does not exist ";

5. java_home indicates the JDK installation path, which is the path c: \ jdk1.6 selected during installation. This path contains Lib, bin, JRE, and other folders (it is best to set this variable, because in the future, tomcat, eclipse, and so on all need to follow * this variable );

Path allows the system to recognize Java commands in any path. It is set:

% Java_home %/bin; % java_home %/JRE/bin

Classpath is the class or lib path of the Java load class. Only the class in classpath can be identified by the Java command and set:

.; % Java_home %/lib/dt. jar; % java_home %/lib/tools. Jar (Add. to indicate the current path)

% Java_home % refers to the previously specified java_home;

6. "Start"->; "run", type "cmd ";

7. type the following commands: "Java-version", "Java", and "javac". If a screen is displayed, the environment variable is successfully configured;

8. Now let's start the first JavaProgramRight.

9. Create a hello. Java file with no location restrictions. The location for creating my hello. Java file is c: \ helloworld. The source code is as follows:

 
Public class Hello {public static void main (string [] ARGs) {system. Out. println ("Hello Java, I am coming .");}}

10. "Start"->; "run ",

Type "cmd" to open the command line window,

Type "cd c: \ helloworld" to enter the c: \ helloworld directory,

Type "javac hello. Java" to compile the hello. Java file (after successful compilation, you will find that a hello. Class file is added to the C: \ helloworld directory ),

Type "Java hello" and execute hello. class file. After successful execution, you will find that the "Hello Java, I am coming. ") so far, we can determine that our Java environment variables have been set successfully.

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.