Linux (CentOS) install jdk1.8 (java)

This article refers to: https://www.cnblogs.com/zs-notes/p/8535275.html

I am new, if you don’t understand, please go to the original text to ask questions, please don’t say "Then can you help me?"

This article does not require you to go to the official website to download the installation package and then upload it to Linux. Because I personally think that is relatively low, so I found the reference article written above. If you have different views, welcome to discuss.

A brief introduction to linux commands:

cd /a/b/c  相当于windows从磁盘开始一级一级往下,然后进入到c文件夹里面
cd a/b/b   相当于windows从当前文件夹开始一级一级往下,然后进入到c文件夹里面
ls  显示当前所在文件夹有哪些文件
vi或vim 加文件名    进入到某个文件里面(不是文件夹)
编辑文件:
进入文件里面之后,按i,然后就进入了编辑模式,可以改动文件内容了,改完了,按键盘左上角的esc按钮,
再打出“:wq”就保存退出了。w是保存,q是退出,q!是强行退出,wq!你猜是什么。

1. Create the corresponding folder

mkdir -p /usr/local/src/jdk

2. View the installer

rpm -qa | grep -i jdk

3. Download the jdk installation package

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie"  http://download.oracle.com/otn-pub/java/jdk/8u131-b11/d54c1d3a095b4ff2b6607d096fa80163/jdk-8u131-linux-x64.tar.gz
注意:如果提示没有wget,请用这个命令安装一下:yum -y install wget

4. Unzip

Note: The installation package downloaded by the original author seems to go directly to the jdk folder created in the first step, but mine does not. The installation package I downloaded is in the src directory, which is the parent directory of the jdk folder I created. Personally suggest that if you also have my situation, move the installation package to the created jdk directory and unzip it.

解压:tar -zxvf jdk-8u131-linux-x64.tar.gz
改名:mv jdk1.8.0_131  jdk1.8
(要是原名称对你视觉和心理不影响,你也可以不改,本人强迫症,那必须给它整了)

5. Configure environment variables

vi /etc/profile
在最后一行加上
(注意这个jdk1.8就是你解压后的文件夹名字,我是把文件夹名字改成了jdk1.8,所以我写jdk1.8,你自己看情况)
export JAVA_HOME=/usr/local/src/jdk/jdk1.8
export PATH=$PATH:$JAVA_HOME/bin

6. Let the configuration file take effect

source /etc/profile

7. Check the jdk version, if there is a display, the installation is successful

java -version

Insert picture description here

Again, refer to this article: https://www.cnblogs.com/zs-notes/p/8535275.html

Guess you like

Origin blog.csdn.net/MYNAMEL/article/details/109386976