Home  >  Article  >  Operation and Maintenance  >  Example tutorial on installing jdk1.7 on CentOS 7

Example tutorial on installing jdk1.7 on CentOS 7

零下一度
零下一度Original
2017-07-17 11:17:401526browse

Check the system version

[root@zabbix ~]# cat /etc/redhat-release 
CentOS Linux release 7.1.1503 (Core) 
[root@zabbix ~]# uname -a
Linux zabbix.com 3.10.0-229.el7.x86_64 #1 SMP Fri Mar 6 11:36:42 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux

1. Check whether the JDK that comes with Linux has been installed

# java -version

2 , View JDK information

# rpm -qa | grep java

Display:

java-x.x.x-gcj-compat-x.x.x.x-xxjpp.xxx

java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx

3. Uninstall (there are several uninstalls)

# rpm -e --nodeps java-x.x.x-gcj-compat- x.x.x.x-xxjpp.xxx

# rpm -e --nodeps java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx

There are some other commands

rpm - qa | grep gcj

rpm -qa | grep jdk

If the openjdk source cannot be found, you can also uninstall it like this

yum -y remove java java-x.x.x -gcj-compat-x.x.x.x-xxjpp.xxx

yum -y remove java java-x.x.x-openjdk-x.x.x.x-x.x.bxx.exx

4. Install JDK

Download Address: (JDK1.7)

http://download.oracle.com/otn-pub/java/jdk/7u79-b15/jdk-7u79-linux-x64.rpm

Place it under /usr/local/src and execute the following installation command:

# rpm -ivh jdk-7u79-linux-x64.rpm

It will be installed under /usr/java by default

5. Check whether it is installed

# java -version

Display: jvav version "1.7.0_79" ...indicates success

6. Configure environment variables

# vi /etc/profile

Add the following lines at the end:

JAVA_HOME=/usr/java/jdk1.7.0_71

CLASS_PATH= .:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

PATH=$JAVA_HOME/bin:$PATH

export JAVA_HOME CLASS_PATH PATH

# reboot Restart the machine configuration to take effect

Or execute the following command to take effect immediately

#source /etc/profile


The above is the detailed content of Example tutorial on installing jdk1.7 on CentOS 7. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn