Install JDK in centos 5

Source: Internet
Author: User

 

  • First:

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 

 

  • Second:

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

 

  • Third:

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

 

  • Last:

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

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.