Check JDK version, uninstall OPENJDK version (the difference between JDK and OPENJDK does not repeat here)
Check the java–version, javac–version command to see the version first (i)
Checked for JDK version 1.7.0.45; re-enter Rpm-qa|grep Java view (ii)
Note: There may be a difference in the version of OPENJDK installed for different CentOS versions; If no list is displayed, you can see the 4th step directly
Uninstall the above three files (requires root permission, login root permission uninstall) (iii)
RPM-E--nodeps java-1.7.0-openjdk-1.7.0.45-2.4.3.3.el6.x86_64
RPM-E--nodeps java-1.6.0-openjdk-1.6.0.0-1.66.1.13.0.el6.x86_64
RPM-E--nodeps Tzdata-java-2013g-1.el6.noarch
View JDK information again (iv)
You are now ready to install the Oracle version of the JDK.
Unzip the JDK, unzip the command: Tar-xvzf jdk-7u25-linux-x64.tar.gz
JDK Location:/home/codebrother/jdk/jdk-7u25-linux-x64.tar.gz, unzip the current path, after decompression, the JDK folder will appear, enter the JDK directory, and see the contents of the directory (v)
Configuring the JDK environment variables
In a Linux system, you need to add the bin directory of the JDK in path, create a classpath, and add the JDK's lib directory.
JDK's home directory:/home/codebrother/jdk/jdk1.7.0_25
The bin directory of the JDK:/home/codebrother/jdk/jdk1.7.0_25/bin
Lib directory for JDK:/home/codebrother/jdk/jdk1.7.0_25/lib
Edit ~/.BASHRC File
Command:
VI ~/.BASHRC
Add the following variable (vi)
Export Java_home=/home/codebrother/jdk/jdk1.7.0_25export java_bin= $JAVA _home/binexport java_lib= $JAVA _home/ Libexport classpath=.: $JAVA _lib/tools.jar: $JAVA _lib/dt.jarexport path= $JAVA _bin: $PATH
Press the ESC key, and then: Wq Save to exit
Make the JDK environment variable effective, source ~/.BASHRC (vii)
View JDK version
Input java-version, javac–version (eight)
Install JDK under Linux and configure environment variables