Download and install JDK in Windows

Source: Internet
Author: User

JDK has the following three versions.
J2se: java standard version, including a series of class libraries for developing desktop applications.
J2EE: includes the Java Standard Edition and adds the class libraries required for enterprise application development.
Java 2 Micro version, used on Small-sized consumer electronic devices with limited resources.

(1) log on to the http://www.sun.com site, according to the operating system used, select the latest version of J2EE.
(2) double-click the downloaded executable file. In the Installation Wizard dialog box, the JDK installation starts.
(3) the installation process is not much different from installing other Windows software. You also need to select the installation path and other steps by clicking the next button multiple times. We recommend that you do not modify the sun/appsever path.
(4) password.
(5) After the installation is successful, add the necessary environment variables for compiling and running. To compile and run a Java program, you must add the classpath environment variable. JDK System Classes are required for compiling and running Java programs, such as Java. Lang. String.
Java programs will search for these classes based on the path specified by the classpath environment variable. Therefore, this environment variable is a series of search paths. To compile and run J2EE applications, the following three jar files are required:
Sun/appserver/JDK/lib/tools. Jar
Sun/appserver/JDK/lib/dt. Jar
Sun/appserver/lib/J2EE. Jar

Three environment variables that need to be set frequently in Java:
Java_home, classpath, path

(1) Configure environment variables: (relative path)

1. java_home = x:/jdk1.6.0 java_home
2. Replace: X:/jdk1.6.0 with % java_home %.
Classpath
.: $ Java_home/lib/tools. jar: $ java_home/lib/dt. jar: $ java_home/lib/activation. jar: $ java_home/lib/mail. Jar
Or
Classpath
./; % Java_home %/lib/tools. jar; % java_home %/lib/dt. Jar
3. Path
; % Java_home %/bin

(2) Configure environment variables: (absolute path)
1. java_home
D:/jdk1.5.0
2. classpath
.; D:/jdk1.5.0/lib/tools. jar; D:/jdk1.5.0/JRE/lib/RT. jar;
3. Path
D:/jdk1.5.0/bin;

(3) execute the following code in batches. It is convenient to set environment variables.

@ Echo off
If exist % 1/bin/java.exe (
If REM enters the correct java2sdk installation directory, it starts to set environment variables.
@ Setx java_home % 1
@ Setx PATH %; % java_home %/bin
@ Setx classpath % ;.
@ Setx classpath %; % java_home %/lib/tools. Jar
@ Setx classpath %; % java_home %/lib/dt. Jar
@ Setx classpath %; % java_home %/JRE/lib/RT. Jar
@ Echo on
@ Echo Java 2 SDK environment parameters are set and exit normally.
) Else (
If "% 1" = ""(
If the installation directory is not provided by REM, exit after prompt
@ Echo on
@ ECHO does not provide the installation directory of java2sdk, and does not set anything. Now exit the environment variable settings.
) Else (
Rem if non-empty installation directory is provided but no bin/java.exe is available, the specified directory is the wrong directory.
@ Echo on
@ ECHO: the installation directory of the invalid java2sdk is not set. Now exit the environment variable settings.
)
)

(4) Other Practices

CMD command settings
Set Path = C:/j2sdk1.4.0/bin

Note: Both environment variables contain ". "path, this ". "indicates the current path of the system. If this path is not added, the class file is already in the current path when the Java program is running, but cannot be found in the file provided by the system.

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.