|
Under CentOS JDK installation
Installation: rpm installation
Software: jdk-7-linux-x64.rpm
The original version of the inspection system
[Root @ abctest~] # java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.1) (rhel-1.45.1.11.1.el6-x86_64)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)
See JDK further information:
[Root @ abctest~] # rpm -qa | grep java
tzdata-java-2012c-1.el6.noarch
java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64
Uninstall OpenJDK, do the following:
[Root @ abctest~] # rpm -e --nodeps tzdata-java-2012c-1.el6.noarch
[Root @ abctest~] # rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64
Install the JDK
Upload a new jdk-7-linux-x64.rpm software to the / usr / local / perform the following actions:
[Root @ abctestlocal] # rpm -ivh jdk-7-linux-x64.rpm
JDK is installed by default in / usr / java in.
Verifying the Installation
Do the following to view the information properly:
[Root @ abctest bin] # java
[Root @ abctest bin] # javac
[Root @ abctest bin] # java -version
java version "1.7.0"
Java (TM) SE Runtime Environment (build 1.7.0-b147)
Java HotSpot (TM) 64-Bit Server VM (build 21.0-b17, mixed mode)
Congratulations, the installation was successful!
Configuration environment variable
I do not have to configure the environment variable machine installing jdk-7-linux-x64.rpm can also perform normal javac, java -version operation, so I do not have to configure JDK environment variable. But the need for future discomfort, here is the record about how to configure, operate as follows:
Modify system environment variables file
vi + / etc / profile
Append the following to the file contents inside:
JAVA_HOME = / usr / java / jdk1.7.0
JRE_HOME = / usr / java / jdk1.7.0 / jre
PATH = $ PATH: $ JAVA_HOME / bin: $ JRE_HOME / bin
CLASSPATH =:. $ JAVA_HOME / lib / dt.jar: $ JAVA_HOME / lib / tools.jar: $ JRE_HOME / lib
export JAVA_HOME JRE_HOME PATH CLASSPATH
Changes to take effect
[Root @ abctest local] # source / etc / profile // changes to take effect immediately
[Root @ abctest local] # echo $ PATH // View PATH value
View system environmental status
[Root @ abctest ~] # echo $ PATH
/usr/local/cmake/bin:/usr/lib64/qt-3.3/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin: /usr/java/jdk1.7.0/bin:/usr/java/jdk1.7.0/jre/bin:/root/bin |
|
|
|