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,: http://download.oracle.com/otn-pub/java/jdk/6u32-b05/jdk-6u32-linux-x64.bin

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

2,Install

A)Extract

1 # sh jdk-6u32-linux-x64.bin

 

B)Copy

1 # cp –r jdk1.6.0_32 /usr/java

 

C)Check whether decompression is successful

1 # cd /usr/java2 3 # ./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)

1 # 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.

DescriptionJavaVersion is1.4, NewJavaVersion is1.6So you need to change the environment variable and replace the built-inJava

D)Set Environment Variables

1 # vi /etc/profile

 

Edit box appears,In"HISTSIZE = 1000"Path for adding Environment Variables:

1 JAVA_HOME=/usr/java3 PATH=$PATH:$JAVA_HOME/bin5 CLASSPATH=.:$JAVA_HOME/lib7 JRE_HOME=$JAVA_HOME/jre

 

In"Export path user logname mail hostname histsize inputrc"Add the following:

1 export JAVA_HOME PATH CLASSPATH JRE_HOME

 

PressEscExit edit box,Then press"Shift +;",InputWq (WriteSave and exit)

1 # source /etc/profile 

 

Make environment variables take effect

E)Set javaAnd javacSymbol connection

This is the defaultJdk (The default value isJDK1.4)Changed to newly installedJdk1.6

1 #cd /usr/bin 3 #ln -s -f /usr/java/jre/bin/java5 #ln -s -f /usr/java/bin/javac

 

F)Restart the system (Or exit and log on again)To make environment variables take effect

1 # reboot

 

G)Check Environment Variables

1 # echo $JAVA_HOME

 

/Usr/java

1 # 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

1 # echo $CLASSPATH

 

.:/Usr/java/lib

H)Check whether the installation and configuration are successful

1 # 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)

 

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.