Centos installation Java Configuring environment Variables
1. View the system version
[Email protected] ~]# java-version
Java Version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea61.11.5)
(rhel-1.45.1.11.1.el6-3-i386)
OpenJDK 64-bit Server VM (build 20.0-b12,mixed mode)
2. further review of JDK information
[Email protected] ~]# Rpm-qa | grep java
Tzdata-java-2012j-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.i686
3. uninstalling the old version of the JDK
[Email protected] ~]# rpm-e--nodepstzdata-java-2012j-1.el6.noarch
[Email protected] ~]# rpm-e--nodepsjava-1.6.0-openjdk-1.6.0.0-1.50.1.11.5.el6_3.i686
4. Installing the JDK
Upload The downloaded jdk package to/usr/local/java below and unzip the tar xvf jdk-7u79-linux-x64.gz
650) this.width=650; "src=" Http://s3.51cto.com/wyfs02/M01/79/41/wKiom1aMu-WAUJQuAAATrCWWb8I096.png "title=" 1.png " alt= "Wkiom1amu-waujquaaatrcwwb8i096.png"/>
(jdk-7u79-linux-x64.gz is a package;jdk1.7.0_79 is the extracted directory)
5. Configure environment Variables
Modify The/etc/profile file,
Vi/etc/profile
At the end, add the following:
Directory of java_home=/usr/local/java/jdk1.7.0_79//java
BIN directory of java_bin=/usr/local/java/jdk1.7.0_79/bin //java
Path= $PATH: $JAVA _bin
Classpath= $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home java_bin PATH CLASSPATH
650) this.width=650; "src=" http://s1.51cto.com/wyfs02/M02/79/40/wKioL1aMvKiwgHpJAAFe03oW_Ck307.jpg "title=" 2.jpg " alt= "Wkiol1amvkiwghpjaafe03ow_ck307.jpg"/>
6. making the changes effective
[[email protected] local]# source/etc/profile// make changes effective immediately
[[email protected] local]# echo $PATH// view PATH value
650) this.width=650; "src=" Http://s2.51cto.com/wyfs02/M00/79/41/wKiom1aMvQ3DWg6RAAARQAfcNbY683.png "title=" 3.png " alt= "Wkiom1amvq3dwg6raaarqafcnby683.png"/>
7. Review The Java version and verify java.
Java–version
650) this.width=650; "src=" Http://s5.51cto.com/wyfs02/M02/79/40/wKioL1aMvQOhrCbcAAAZYyhKcUY150.png "title=" 4.png " alt= "Wkiol1amvqohrcbcaaazyyhkcuy150.png"/>
This article is from "Yangdong Hao" blog, please make sure to keep this source http://506554897.blog.51cto.com/2823970/1732110
Centos installation Java configuration environment variables