Install jdk under linux

1. JDK installation

The version used is centos 6, rpm and software related commands are equivalent to the software assistant management software under windows

step:

1) Check whether the current Linux system has java installed

To view the jdk of the current system itself, enter rpm-qa | grep java


2) Uninstall both openJDK

Enter rpm -e --nodeps software to uninstall


3) Use the yum command to install JDK

First check which jdk versions are in the yum library (only openjdk is found for the time being)

Type yum search java|grep jdk


4) Select version 1.7 to install  yum install java-1.7.0-openjdk

After installation, the default installation directory is: /usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64

5) Next, you need to configure the environment variable  [root@centos /]# vi /etc/profile

Add the following to the profile file

#set java environment
JAVA_HOME=/usr/lib/jvm/java-1.7.0-openjdk-1.7.0.75.x86_64
JRE_HOME=$JAVA_HOME/jre
CLASS_PATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib
PATH=$PATH:$JAVA_HOME/bin:$JRE_HOME/bin
export JAVA_HOME JRE_HOME CLASS_PATH PATH

Press Esc: wq save and exit

6) Reload the /etc/profile configuration file [root@centos /]# source/etc/profile

7) Check if java is installed java -version


It is configured as shown.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325583751&siteId=291194637