Multiple ways to install JDK under Linux

Source: Internet
Author: User

First, environmental description:
Operating system: Linux xx-42.6. -431.23. 3. el6.x86_64 #1:wuyi x86_64x86_64 x86_ gnu/Linux JDK version: Java-1.7. 0-openjdk.x86_64
Second, RPM mode installation:

1, download rpm software package, download here is jdk-7u21-linux-i586.rpm.

Modify file Permissions:

[[Email protected]4chmod755 jdk-7u21-linux-i586.rpm


2. Install using the RPM command:

[[Email protected]4 ~]# RPM-IVH jdk-7u21-linux-i586.rpm

3. Check the installation path:

[[Email protected]4 ~]# rpm-ql JDK
4. Set the JAVA_HOME environment variable and add it to path: Set the way below.

Three, yum mode installation:

1, yum query can install the software:

[[Email protected]4yumgrep JDK

Select the java-1.7.0-openjdk.x86_64 in the list above to install.

2. Yum installation software:

[Email protected]4yuminstall java-1.7. 0-openjdk.x86_64

By the way, java-1.7.0-openjdk-devel.x86_64 also installed.

[Email protected]4yuminstall -y java-1.7. 0-openjdk-devel.x86_64

3. Yum to view installed software:

[Email protected]4yumgrep  Jdkjava-1.7. 0-openjdk.x86_64          1:1.7.  0.91-2.6. 2.2 . el6_7            @updates Java-1.7. 0-openjdk-devel.x86_64    1:1.7.  0.91-2.6. 2.2. el6_7            @updates

4. Yum Delete the installed packages:

[Email protected]4yum remove java-1.7. 0-openjdk-devel.x86_64

5, query the path after installation:

[[Email protected]4grep JDK

[Email protected]4 ~]# rpm-ql java-1.7. 0-openjdk-1.7. 0.91-2.6. 2.2. el6_7.x86_64

The JDK is installed under the/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.91.x86_64 path.

6. Set the JAVA_HOME environment variable and add the JDK Bin directory to path.

There are two more common settings, modify/etc/profile or modify the ~/.bash_profile. The former is a global setting, which can control settings at the user level.

Either of the above options, add the following to the file:

Export java_home="/usr/lib/jvm/jre-1.7.0-openjdk.x86_64"export PATH= $JAVA _ Home/bin: $PATH

7. View the JDK version:

[[Email protected]4 ~]# java-version

Multiple ways to install JDK under Linux

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.