Install JDK1.6 in CentOS

Source: Internet
Author: User

1. Software

A) download jdk address, this document sample jdk for jdk-6u32-linux-x64.bin, click here.

B) unless otherwise stated, this document serves as the root user.

2. Installation

A) decompress

# Sh jdk-6u32-linux-x64.bin

B) Copy

# Cp-r jdk1.6.0 _ 32/usr/java

C) check whether the decompression is successful

# Cd/usr/java

#./Bin/java-version

Java version "1.6.0 _ 32"

Java (TM) SE Runtime Environment (build 1.6.0 _ 32-b03)

Java HotSpot (TM) Client VM (build 11.3-b02, mixed mode)

# Java-version

Java version "1.4.2"

Gij (GNU libgcj) version 4.1.2 20070626 (Red Hat 4.1.2-14)

Copyright (C) 2006 Free Software Foundation, Inc.

The built-in java version is 1.4 and the new java version is 1.6. Therefore, you need to change the environment variable and replace the built-in java

D) Set Environment Variables

# Vi/etc/profile

In the edit box, add the environment variable path under "HISTSIZE = 1000:

JAVA_HOME =/usr/java

PATH = $ PATH: $ JAVA_HOME/bin

CLASSPATH =.: $ JAVA_HOME/lib

JRE_HOME = $ JAVA_HOME/jre

Add the following content under "export path user logname mail hostname histsize inputrc:

Export JAVA_HOME path classpath JRE_HOME

Press Esc to exit the edit box, press Shift +;, and enter wq (write, save, and exit)

# Source/etc/profile

Make environment variables take effect

E) set the symbolic connection between java and javac.

This is to change the default jdk (JDK1.4 by default) to the newly installed jdk 1.6.

# Cd/usr/bin

# Ln-s-f/usr/java/jre/bin/java

# Ln-s-f/usr/java/bin/javac

F) restart the system (or exit and log on again) to make the environment variable take effect.

# Reboot

G) Check Environment Variables

# Echo $ JAVA_HOME

/Usr/java

# Echo $ PATH

/Usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin: /usr/bin: // usr/java/bin:/root/bin

# Echo $ CLASSPATH

.:/Usr/java/lib

H) check whether the installation and configuration are successful.

# Java-version

Java version "1.6.0 _ 32"

Java (TM) SE Runtime Environment (build 1.6.0 _ 32-b03)

Java HotSpot (TM) Client VM (build 11.3-b02, mixed mode)

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.