1. CentOSby default, installation of theOpenOfficeSoftware that requiresJavasupport, the default is to installJDKenvironment, if you need a specificJavaenvironment, it is best to set the defaultJDKcompletely removed;
2. view default JDK command: java–version
3. If you first remove the default reload new JDK Then the software associated with it will be deleted, so , load the new re-unloading defaults first.
4. Download the JDK
wget http: // download.oracle.com/otn/java/jdk/7u67-b01/jdk-7u67-linux-x64.rpm? Authparam=1417193298_0c5dbcff91b911f8a602fb3bfc2e2a12
5. install: RPM–IVH jdk-7u67-linux-x64.rpm After installation is complete, in /USR directory produces a new Java folder
6. Set environment variable
vi Open File command: vim /etc/profile
move to the end of the file insert a blank line (enter the letter G ): Enter the letter o
Enter the following configuration information: ( Note: The delimiter here is a colon is not a semicolon )
java_home=/usr/java/jdk1.7.0_67
Path= $JAVA _home/bin: $PATH
Classpath=.: $JAVA _home/lib/dt.jar: $JAVA _home/lib/tools.jar
Export Java_home
Export PATH
Export CLASSPATH
press esc exit edit mode and save exit input : wq! (Colon also entered) Now, new JDK The environment is set.
(I did not try the following steps)
7. Uninstalling the original JDK
terminal input, view gcj version number:rpm-qa|grep JDK
Get results:
Jdk-1.7.0_04-fcs.x86_64
Java-1.6.0-openjdk-1.6.0.0-1.49.1.11.4.el6_3.x86_64
terminal input, uninstall: yum-y Remove Java java-1.6.0-openjdk-1.6.0.0-1.49.1.11.4.el6_3.x86_64
wait for the system to automatically uninstall, the final terminal display Complete, uninstall completed
8. Allow system configuration to take effect immediately without rebooting the system
Terminal input command:source/etc/profile
Note: If the following error message appears
bash:/usr/java/jdk1.7.0_04/lib/dt.jar: insufficient permissions
Bash:/usr/java/jdk1.7.0_04/lib/tools.jar: insufficient permissions
error reason: delimiter cannot be used ;( semicolon :
Classpath=.; $JAVA _home/lib/tools.jar; $JAVA _home/lib/dt.jar
This is not a drop, To write this:
Classpath=.: $JAVA _home/lib/tools.jar: $JAVA _ Home/lib/dt.jar
PATH = $PATH; $JAVA _home/bin; Same, all separated by colons.
9. View version:java-version
Java Version "1.7.0_04"
Java (TM) SE Runtime Environment (build 1.7.0_04-b20)
Java HotSpot (TM) 64-bit Server VM (build 23.0-b21, Mixed mode)
Install JDK 64-bit under CentOS 6