Check whether the JDK that comes with Linux is installed (uninstall centos 1.4 installed)
The installed centos comes with openjdk and uses the Java-version command. The following information is displayed:
# java -version
java version “1.6.0"OpenJDK Runtime Environment (build 1.6.0-b09)OpenJDK 64-Bit Server VM (build 1.6.0-b09, mixed mode)
You 'd better uninstall openjdk first and install Sun's JDK. View
# rpm -qa | grep javajava-1.4.2-gcj-compat-1.4.2.0-40jpp.115java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
Uninstall:
# rpm -e --nodeps java-1.4.2-gcj-compat-1.4.2.0-40jpp.115# rpm -e --nodeps java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
There are other commands
# rpm -qa | grep gcj# rpm -qa | grep jdk
If openjdk source cannot be found, you can uninstall it like this.
# yum -y remove java java-1.4.2-gcj-compat-1.4.2.0-40jpp.115# yum -y remove java java-1.6.0-openjdk-1.6.0.0-1.7.b09.el5
If the downloaded package is in the tar.gz format:
Download jdk-8u25-linux-x64.tar.gz
: Http://www.oracle.com/technetwork/java/javase/downloads/index.html
Decompress the file to/usr/Java/(if there is no Java path, create one first). The extracted file name is jdk1.8.0 _ 25 and renamed JDK.
# tar -zxv -f jdk-8u25-linux-x64.tar.gz# mv jdk1.8.0_25 jdk
So far, the installation is basically complete. Next we need to set the environment variables.
If the downloaded package is in RPM format:
# rpm -ivh jdk-8u25-linux-x64.rpm
One is to modify the. bashrc file or. bash_profile file.
// Add the following lines at the end of the file: Export java_home =/usr/Java/jdkexport Path = $ path: $ java_home/bin: $ java_home/JRE/binexport classpath =.: $ java_home/lib: $ java_home/JRE/lib
One is to modify the. profile.
# Vi/etc/profile // Add the following lines to the end of the file: Export java_home =/usr/Java/jdkexport Path = $ path: $ java_home/bin: $ java_home/JRE/binexport classpath =.: $ java_home/lib: $ java_home/JRE/lib # source/etc/profile
View installation status
# java -versionjava version “1.8.0_25”Java(TM) SE Runtime Environment (build 1.8.0_25-b17)Java HotSpot(TM) 64-Bit Server VM (build 25.25-b02, mixed mode)
References:
1 http://blog.163.com/?email protected]/blog/static/4226801820127953017837/
2 http://wenku.baidu.com/link? Url = l46l-_ af-5WHZ6Gf3yBZlHH5z5Vz6leJ6ehPpZj-P18o6AwN3bKTfhDBsoM2zgl5PBcm9i8XcbvNY4Yah8T8gm_a_sXcVsFFCxax3u06Zse
Install JDK in centos 5