Installing JDK under Linux system

HairLossException 2022-01-26 11:30:43 阅读数:738

installing jdk linux

stay Linux There are three ways to install software under the system :

  • rpm install
  • Unzip installation
  • yum Online installation

This is just a demonstration rpm There are two ways of installation and decompression installation

One 、rpm install :

1.1 download JDK Of rpm package

Here I offer jdk8 Version of ( You can also download it from the official website )
link :https://pan.baidu.com/s/1BR-ULB2TC1hqU9KqyhhnQQ
Extraction code :5hsa

1.2 use xftp Upload rpm Package to Linux /opt Under the table of contents

 Insert picture description here
To /opt Check whether there is this file in the directory
 Insert picture description here

1.3、 Check whether the current system exists java Environmental Science

Input instruction java -version

 Insert picture description here

If there is already installed openjdk

  • rpm -qa|grep jdk testing jdk Version information
  • rpm -e --nodeps java Version information uninstall jdk

 Insert picture description here
 Insert picture description here

 Insert picture description here

1.4 install JDK

Input instruction rpm -ivh jdk-8u221-linux-x64.rpm ( Input jdk Post press Tab Automatic completion )

 Insert picture description here
Installation is complete here
notes :rpm There is no need to configure the environment for installation

1.5 test :

 Insert picture description here

Two 、 Unzip installation

2.1、 use xftp Upload the compressed package to Linux

 Insert picture description here
Check whether to upload
 Insert picture description here

2.2 Check whether the current system exists java Environmental Science

 Insert picture description here

2.3、 Unzip the package you just uploaded to /opt Under the table of contents

Input instruction tar -zxvf jdk-8u121-linux-x64.tar.gz -C /opt

 Insert picture description here

2.4、 Configure environment variables

Input instruction vim /etc/profile

 stay profile At the end of the file, enter :
JAVA_HOME=/opt/jdk1.8.0_121(jdk The installation directory )
PATH=$JAVA_HOME/bin:$PATH
CLASSPATH=$JAVA_HOME/lib:.
export JAVA_HOME PATH CLASSPATH

How to use vim The editor can refer to This article
 Insert picture description here

2.5 Shut down and restart

If you don't want to shut down and restart, you can go to /etc Use instructions under the directory source profile

2.6、 test

 Insert picture description here
use java -version You can see
 Insert picture description here

copyright:author[HairLossException],Please bring the original link to reprint, thank you. https://en.javamana.com/2022/01/202201261130408302.html