Test learning-106-install jdk on Linux

Foreword:

I believe everyone is familiar with jdk, today I will talk about the detailed steps of dark account jdk on Linux.

1. Execute commands to query the system's own JDK service

     Sometimes the Linux Centos we install may bring java, but it is not the version we want, so we can first check whether Centos has java installed. If you don’t want the shoes, install the version you want.

rpm -qa | grep java

可能得到以下结果:

java-1.8.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
java-1.8.0-openjdk-1.8.0.102-4.b14.el7.x86_64
……
javapackages-tools-3.4.1-11.el7.noarch

If it is found that it is not the version we want, such as 1.7 java, we can uninstall it.

2. Execute commands to uninstall some of the built-in java services

rpm -e --nodeps java-1.7.0-openjdk-headless-1.8.0.102-4.b14.el7.x86_64
rpm -e --nodeps java-1.7.0-openjdk-1.8.0.102-4.b14.el7.x86_64

3. Install java1.8 version

Upload the software package jdk-8u181-linux-x64.tar.gz to a directory in Linux, such as /home/download

The address of the software package provided in this article:

3.1 Execute the following commands:

tar xvf jdk-8u181-linux-x64.tar.gz   进行解压缩

mv jdk1.8.0_181 jdk                  更改目录名称为jdk

3.2 Configure environment variables:

vi  etc/profile

Add the following command to the file

export JAVA_HOME=/home/download/jdk

export JRE_HOME=/home/download/jdk/jre

export PATH=$PATH:$JAVA_HOME/bin

export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

 

 

 

 

Save the file after modification

3.3 Verification takes effect

Execute the source /etc/profile command

Execute java -version 

If the following shows the version number, it means the installation is successful.

If you have any questions, you can leave a message, and you will definitely reply when you see it.

Guess you like

Origin blog.csdn.net/u013521274/article/details/109539711