Install JDK and centosjdk in CentOS 7

Source: Internet
Author: User

Install JDK and centosjdk in CentOS 7

1. Uninstall the built-in openjdk

1. Run the following command to query the built-in jdk:

rpm -qa | grep java

The existing jdk in the system is listed. If the jdk exists, uninstall it. If the jdk does not exist, install it directly.

2. Run the following command to uninstall:

Rpm-e -- nodeps jdk name

Jdk installation can be performed after uninstallation. The query and uninstallation operations are as follows:

Ii. jdk Installation

1. Download jdk and upload it to the/usr/java directory.

JDK 7 is: http://www.oracle.com/technetwork/java/javase/downloads/jdk7-downloads-1880260.html select the corresponding linux version, download rpm file. Here the jdk-7u79-linux-x64.rpm is selected. And upload it to the/urs/java directory of Linux (create if the java directory does not exist ).

2. Unzip and install

Run the following command to decompress the package:

Rpm-ivh rpm file name

Shows the running result.

3. Configure the profile file

Run the following command:

vi /etc/profile

Add the following content to the end of the profile file and keep it

export JAVA_HOME=/usr/java/jdk1.7.0_79export CLASSPATH=.:$JAVA_HOME/jre/lib/rt.jar:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jarexport PATH=$PATH:$JAVA_HOME/bin

/Usr/java/jdk1.7.0 _ 79 indicates the jdk path.

Run the following command to make the configuration take effect.

source /etc/profile

Run the following command to check whether jdk is successfully installed:

java -version

The related operation diagram is as follows:

 

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.