Install and configure JDK-7 in Linux CentOS 6.5

Source: Internet
Author: User

Install and configure JDK-7 in Linux CentOS 6.5

System Environment: CentOS-6.5
Installation Method: rpm Installation
Software: jdk-7-linux-i586.rpm
: Http://www.Oracle.com/technetwork/java/javase/downloads/index.html

Check the original system version
[Root @ localhost ~] # Java-version
Java version "1.7.0 _ 24"
OpenJDK Runtime Environment (build 1.7.0 _ 24-b18)
OpenJDK HotSpot (TM) Client VM (build 24.45-b08, mixed mode, sharing)

To further view the JDK information:
[Root @ localhost ~] # Rpm-qa | grep java
Tzdata-java-2012c-1.el6.noarch
Java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64

Uninstall OpenJDK and perform the following operations:
[Root @ localhost ~] # Rpm-e -- nodeps tzdata-java-2012c-1.el6.noarch
[Root @ localhost ~] # Rpm-e -- nodeps java-1.7.0-openjdk-1.7.0.45-1.45.1.11.1.el6.x86_64

Install JDK
Upload new jdk-7-linux-i586.rpm software to/usr/local/to perform the following operations:
[Root @ localhost ckb] # rpm-ivh jdk-7-linux-i586.rpm
JDK is installed in/usr/java by default.

Verify Installation
Perform the following operations to check whether the information is normal:
[Root @ localhost bin] # java
[Root @ localhost bin] # javac
[Root @ localhost bin] # java-version
Java version "1.7.0 _ 45"
Java (TM) SE Runtime Environment (build 1.7.0 _ 45-b18)
Java HotSpot (TM) Client VM (build 24.45-b08, mixed mode, sharing)

Configure Environment Variables
After installing the jdk-7-linux-i586.rpm on my machine, I can still perform the javac and java-version operations without configuring environment variables, so I didn't configure JDK environment variables. However, for future discomfort, we should record how to configure it as follows:
Modify the system environment variable File
Vi +/etc/profile

Append the following content to the file:
JAVA_HOME =/usr/java/jdk1.7.0 _ 45
JRE_HOME =/usr/java/jdk1.7.0 _ 45/jre
PATH = $ PATH: $ JAVA_HOME/bin: $ JRE_HOME/bin
CLASSPATH =: $ JAVA_HOME/lib/dt. jar: $ JAVA_HOME/lib/tools. jar: $ JRE_HOME/lib
Export JAVA_HOME JRE_HOME PATH CLASSPATH

Make the modification take effect
[Root @ localhost ~] # Source/etc/profile // make the modification take effect immediately
[Root @ localhost ~] # Echo $ PATH // view the PATH value

View system environment status
[Root @ localhost ~] # Echo $ PATH
/Usr/lib/qt-3.3/bin:/usr/local/sbin:/usr/sbin: /usr/java/jdk1.7.0 _ 45/bin:
/Usr/java/jdk1.7.0 _ 45/jre/bin:/home/ckb/bin

Install JDK 7 In Ubuntu (with Clojure download)

Install JDK 12.04 in Ubuntu

CentOS6.3 install JDK and environment Configuration

Install JDK 8 on Ubuntu 14.04

Install JDK graph analysis in Ubuntu

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.