How to install java6.0 in Windows

Source: Internet
Author: User

The installed JDK is an executable Installer. Double-click to install it. Change the installation path to c: \ jdk1.6.0 (other paths can also be used ).

After JDK is installed, set the environment variables:

Right-click my computer, select "properties", and select the "advanced" tab to go to environment variable settings and set the following three environment variables:
(1) set the PATH variable so that we can run Java applications, such as javac, Java, and javah anywhere in the system. We need to find the JDK installation directory, for example, if our JDK is installed in the C: \ jdk1.6.0 directory, it is a common Java application under the c: \ jdk1.6.0 \ bin directory: \ jdk1.6.0 \ bin directory is added to the PATH environment variable.

Find the PATH variable in the system variable and choose "-> edit". (There are many variable values in it. c: \ jdk1.6.0 \ bin is added at the beginning of the variable value ;)
Variable name: Path
Variable value: C: \ jdk1.6.0 \ bin;

(2) The classpath environment variable is used to let the Java interpreter know where to find the class when we need to reference the classes written by others during Java program development. Sun usually provides us with some additional rich class packages, one of which is DT. jar, one is tools. jar, both jar packages are located in the C: \ jdk1.6.0 \ lib directory, So we usually add these two jar packages to our classpath environment variable set classpath = .; c: \ jdk1.6.0 \ Lib \ tools. jar; C: \ jdk1.6.0 \ Lib \ DT. jar.

In the system environment variable column, click-> Create classpath
Variable name: classpath
Variable value :.; % java_home % \ Lib \ tools. jar; % java_home % \ Lib \ DT. jar; (Note that there is a ". ", indicating the current directory. When we run Java Aclass, the system will first find the Aclass file in the current directory .);

(3) set java_home:

First, for reference convenience. For example, if JDK is installed in the C: \ jdk1.6.0 directory, set java_home to the directory path. When this path is used in the future, you only need to enter % java_home % to avoid entering a long path string for each reference;

The second is the normalization principle. When the JDK path is changed, you only need to change the variable value of java_home. Otherwise, you need to change any document that uses the absolute path to reference the JDK directory, if the JDK cannot be found for a program in case of incomplete modification, the result can be imagined-system crash!

Third, the third-party software will reference the agreed java_home variable. Otherwise, you cannot use the software normally.

In the system environment variable column, click-> Create java_home (java_home points to the JDK installation path)
Variable name: java_home
Variable value: C: \ jdk1.6.0

After the configuration is complete, write a simple Java program to test whether j2sdk has been installed successfully:

Public class helloworld {

Public static void main (string [] ARGs ){

Ystem. Out. println ("Hello world! ");

}

}

Save the program as a document named helloworld. java.

Open the Command Prompt window, go to the directory of helloworld. Java, and type the following command

Javac helloworld. Java

Java helloworld

At this time, if helloworld is printed, the installation is successful. If this sentence is not printed, check whether the above configuration is correct.

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.