Windows installation JDK is simple, but often novice ask Linux how to install the JDK, the following installation steps introduced, this article in the case of CentOS Linux, The installed JDK version is 1.7.0.25 (jdk-7u25-linux-x64.tar.gz), the master please drift over.
- 1
Download the JDK package to the specified directory
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, vi ~/.BASHRC
Add the following variable (vi)
Export java_home=/home/codebrother/jdk/jdk1.7.0_25
Export java_bin= $JAVA _home/bin
Export java_lib= $JAVA _home/lib
Export classpath=.: $JAVA _lib/tools.jar: $JAVA _lib/dt.jar
Export 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)
If the above information appears, it proves that the JDK installation was successful! Java development is now available.