1. Query whether a JDK is installed by default
[[email protected] bin]"1.6.0_22"Environment (1.10. 4) (rhel-1.41. 1.10.4.el6-x86_64)64-20.0-b11, mixed mode)
2. Remove the default installation of OPENJDK
[[Email protected]Bin# Rpm-qa | grep jdkjava-1.6.0-openjdk-javadoc-1.6.0.0-1.41.1.10.4.el6.x86_64java-1.6.0-openjdk-1.6.0.0-1.41.1.10.4.el6.x86_64java-1.6.0-openjdk-devel-1.6.0.0-1.41.1.10.4.el6.x86_64[[email protected]bin] # RPM-E--nodeps java-1.6.0-openjdk-javadoc-1.6.0.0-1.41.1.10.4.el6.x86_64[[email protected] bin]# rpm-e --nodeps Java-1.6.0-openjdk-1.6.0.0-1.41.1.10.4.el6.x86_64[[email protected] bin]# rpm-e--nodeps Java-1.6.0-openjdk-devel-1.6.0.0-1.41.1.10.4.el6.x86_64[[email protected] bin]# Rpm-qa | grep jdk[[email Protected] bin]#
3. Oracle website download
Go to the website by yourself
< span class= "comment" >< span class= "variable" >< span class= "constant" > < span class= "comment" >< span class= "variable" >jdk1.6.0_45- linux-x64.tar.gz
4. Installing the JDK
[Email protected] soft]# TAR-ZXVF< span class= "comment" >< span class= "variable" >< span class= "constant" > < span class= "comment" >< span class= "variable" >jdk1.6.0_45 -linux-x64.tar.gz[[Email protected] ~]# Mkdir/usr/java[[email protected] ~]# mv jdk1.6.0_45//usr/java/jdk1.6.0 _45
5. Configuring the JDK environment variables
To configure/etc/profile, add the following configuration to the end of the file:
Java_home=/usr/java/jdk1.6.0_45classpath=.:$JAVA _home/lib.tools.jarpath=$JAVA _home/bin:$PATHexport Java_home CLASSPATH PATH
To configure the. Bash_profile for a normal user, example with Crxj-app as an example, you can vi/home/crxj-app/.bash_profile, plus the following configuration:
Java_home=/usr/java/jdk1.6.0_45java_bin=/usr/java/jdk1.6.0_45/binclasspath=.:$JAVA _home/lib/tools.jar: $JAVA _home/lib:$JAVA _home/binexport java_home java_bin classpathexport path=$PATH:$JAVA _home/bin
Effective configuration environment
[Crxj-app@CRXJ-app-2 UAP]$ source/etc/profile
Test your JDK Environment
#下列任意命令都可以检测JDK环境是否安装正确java-versionjavac-version$JAVA _home
Install JDK under Linux and configure environment variables