Installation Instructions system environment: centos-6.3 installation method: rpm installation software: jdk-7-linux-x64.rpm: license installation instructions
System environment: centos-6.3
Installation method: rpm installation
Software: jdk-7-linux-x64.rpm
: Http://www.oracle.com/technetwork/java/javase/downloads/java-se-jdk-7-download-432154.html
Check the original system version
[Root @ admin ~] # 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 between 0-b12, mixed mode) |
To further view the JDK information:
[Root @ admin ~] # 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 and perform the following operations:
[Root @ admin ~] # Rpm-e -- nodeps tzdata-java-2012c-1.el6.noarch [Root @ admin ~] # Rpm-e -- nodeps java-1.6.0-openjdk-1.6.0.0-1.45.1.11.1.el6.x86_64 |
Install JDK
Upload new jdk-7-linux-x64.rpm software to/usr/local/to perform the following operations:
[Root @ admin local] # rpm-ivh jdk-7-linux-x64.rpm |
JDK is installed in/usr/java by default.
Verify installation
Perform the following operations to check whether the information is normal:
[Root @ admin bin] # java [Root @ admin bin] # javac [Root @ admin 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 is successful!
Configure environment variables
After installing the jdk-7-linux-x64.rpm on my machine, I can still perform the javac and java-version operations without configuring environment variables, so I didn't configure JDK environment variables. However, for future discomfort, we should record how to configure it as follows:
Modify the system environment variable file
Append the following content to the file:
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 |
Make the modification take effect
[Root @ admin local] # source/etc/profile // make the modification take effect immediately [Root @ admin local] # echo $ PATH // view the PATH value |
View system Environment Status
[Root @ admin ~] # 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 |