There are two ways to install jdk on linux: manual installation and yum installation:

linux install jdk

There are two ways to install jdk: manual installation and yum installation:

1. The installation of yum is as follows:

1.1 Query the version of jdk to be installed

Command: yum -y list java*

Insert picture description here

1.2 Install jdk1.8

命令:yum install -y java-1.8.0-openjdk.x86_64

1.3 Query jdk version

Command: java -version

In this way, the installation is successful.
Installed tousr/lib/jvm/

2. Manual installation is as follows:

2.1 Download the jdk1.8 compressed package:

The official website link is as follows:
https://www.oracle.com/java/technologies/javase/javase-jdk8-downloads.html

Insert picture description here

To download for the first time, you need to register for an Oracle account. Follow the normal process to register and log in to download. In addition, students can also go to Baidu Netdisk to download. Share a link here

Link: https://pan.baidu.com/s/1tJVUDqc3YpwygtPM6QxD1w Extraction code: 36s2

2.3 Upload jdk to linux and unzip:

Use xftp or xshell to transfer files directly.
If it is xshell to directly drag files, a package is required:

yum -y install lrzsz

After uploading, you can perform the following operations, insert the picture description here

Go to the folder where we store the software, put the compressed package just downloaded in this directory and unzip

Command: tar -zxvf jdk-8uxxx-linux-x64.tar.gz (jdk-8...this is the name of the jdk just downloaded)

Insert picture description here
For the convenience of configuring environment variables later, change the folder name to jdk

mv jdk1.8.0_161/ jdk

Insert picture description here

2.3 Configure environment variables

Command: vim /etc/profile

Insert picture description here

JAVA_HOME=/apps/jdk
PATH=/apps/jdk/bin:$PATH
export JAVA_HOME PATH

Save and exit (wq) to let the configuration file take effect

source /etc/profile

2.4 Check whether the installation is successful:

Query jdk version command: java -version

Insert picture description here
Sincerely, the JDK is installed in Linux

Looking forward to your comments

Guess you like

Origin blog.csdn.net/m0_50217781/article/details/112414571