JDK installation configuration (for Windows and for Linux)

Source: Internet
Author: User

One, for Windows
1, the preparation of the JDK can be downloaded directly on the website, you can also link:
Http://pan.baidu.com/s/1qW0XiJM (x64)
Http://pan.baidu.com/s/1eQzpGaQ (x32)

2. Click Jdk-7u67-windows-x64.exe or Jdk-7u75-windows-i586.exe to install directly
The location I installed is the default location C:\Program files\java\jdk1.7.0_71
Note: This installation can be installed without the JRE because the JRE is installed in the C:\Program files\java\jdk1.7.0_71 directory.
3. Configure Environment variables:
(1), Start menu Right-click on "Computer"-"Properties"-"Advanced system Settings"--"Environment variables"
(2), in the system variable to create a new java_home variable, the value of the variable is: C:\Program files\java\jdk1.7.0_71 (according to their own installation path fill)

(3) New CLASSPATH variable, the value of the variable is:.; %java_home%\lib;%java_home%\lib\tools.jar Note: There is one at the front.

(4) Add variable value in Path variable (existing without new):%java_home%\bin;%java_home%\jre\bin; (Note the ";" between the variable values) Separated, can be added at the front)

4, Win+r (run)--input "cmd"--"Java", and then enter "Javac", if you can print the usage instructions successfully configured!

Analysis of supplemental environment variables:

Installation path for JAVA_HOME:JDK

Classpath:java load Classpath, only the class is recognized by the Java command in Classpath, and a "." is added before the path. Represents the current path.

Path: The Java,javac command can be recognized by the system under any path.

II. For RedHat Linux

1, the preparation of the JDK can be downloaded directly on the website, you can also link:
http://pan.baidu.com/s/1sClI2

JDK 1.7:http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html

Save in/opt/directory after download

There are two points to note during the download process:

1): Note the operating system version, and the 32-bit or 64-bit operating system. As shown below, Linux is divided into x86, x64 two kinds,

2): Note whether the installation package is in RPM or tar.gz format. RPM is the standard installation package for Red Hat and some Linux systems are not supported by Redhat packages. RPM installation will be automatically configured, usually Lib installed to/urs/bin, bin installed under the/usr/bin, if not installed under/urs/bin, will also establish a soft connection in this directory.

2, Check whether there are other versions of the JDK on the Linux system, if any, uninstall the old version of JKD first.

[Email protected]/]# java-version

Java Version "1.4.2"

Gij (GNU libgcj) version 4.1.2 20080704 (Red Hat 4.1.2-51)

Copyright (C) 2006 free Software Foundation, Inc.

This was free software; See the source for copying conditions. There is NO

Warranty Not even to merchantability or FITNESS for A particular PURPOSE.

Note: It may appear that the installed version is not the same

View information about your own JDK

[Email protected] ~]# Rpm-qa | grep GCJ

Libgcj-4.1.2-51.el5

java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

Libgcj-4.1.2-51.el5

Uninstalling the information of your own JDK

[Email protected]/]# rpm-e--nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115

3. Unpack and install the JDK

RPM Package Installation

[email protected] opt]# chmod +x *.rpm

[email protected] opt]# rpm-ivh *.rpm

Preparing ... ########################################### [100%]

1:JDK ########################################### [100%]

Unpacking JAR files ...

Rt.jar ...

Jsse.jar ...

Charsets.jar ...

Tools.jar ...

Localedata.jar ...

Tar Package Installation

New Folder/opt/java/

[Email protected] opt]# mkdir java

[Email protected] opt]# cd/opt

[Email protected] opt]# tar xzvf *.tar.gz-c/opt/java/

Note: * Represents the package name you installed

4. Configure Environment variables

[Email protected] opt]# CD java/

[[email protected] java]# ls

jdk1.7.0_67

[[email protected] Java] #cd jdk1.7.0_67

[[email protected] jdk1.7.0_67] #pwd

/opt/java/jdk1.7.0_67

At the end of the Etc/profile file, add

Export Java_home= /opt/java/jdk1.7.0_67

Export classpath= /opt/java/jdk1.7.0_67/lib

Export path= $JAVA _home/bin: $PATH

If you do not want to re-system, you can use the command source/etc/profile to make the configuration file effective immediately. Otherwise, the system can only be restarted for the configuration parameters to take effect.

[Email protected] ~]# Source/etc/profile

Verify that the environment variable is in effect

[Email protected] ~]# echo $JAVA _home

/opt/java/jdk1.7.0_67

[Email protected] ~]# echo $PATH

/opt/java/jdk1.7.0_67/bin:/usr/kerberos/sbin:/usr/kerberos/bin

:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin:/usr/x11r6/bin:/root/bin

[Email protected] ~]# echo Echo $CLASSPATH

/opt/java/jdk1.7.0_67/lib

Verify that the installation is successful, and that the environment variable is active

[Email protected] tmp]# java-version

Java Version "1.7.0_67"

Java (TM) SE Runtime Environment (build 1.7.0_67-b01)

Java HotSpot (TM) 64-bit Server VM (build 24.65-b04, Mixed mode)

The installation is successful!!

Remove the TMP directory under the JDK installation package

JDK installation configuration (for Windows and for Linux)

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.