centos 7 installation jdk8

premise

The installation of the current user is root

Download the installation package

Now oracle official website to download jdk need to log in before you can download, so download the installation package is too much trouble.
download link:

http://www.oracle.com/technetwork/java/javase/downloads/index.html

I downloaded this version
jdk-8u241-linux-x64.tar.gz

Clear default jdk

### to see if there is a default installation of the JDK 
RPM -qa | grep the Java RPM -qa | grep the JDK RPM -qa | grep gcj ### if you use the batch uninstall command RPM -qa | grep the Java | xargs RPM -e - -nodeps

Create a java directory

mkdir -p /usr/java/ && cd /usr/java/

File Upload

### can use rz command, no command install, very easy to use file upload tool
 yum  install - the y-lrzsz 

enter rz press Enter to bring up the file selection window.

Decompression

tar -zxvf jdk-8u241-linux-x64.tar.gz

Configuration environment variable

VI / etc / Profile 
The following configuration is added to the end (Command mode: file Shift + G command to skip to the end of the file), then save and exit. 

Java8 # 
Export JAVA_HOME . = / Usr / the Java / jdk1 8 .0_241 
Export the PATH = $ JAVA_HOME / bin: $ the PATH

It makes the configuration take effect

source /etc/profile

Verifying the Installation

java -version

Remove the installation package

### save resources
 RM -rf / usr / the Java / the JDK-8u241-Linux-x64. Tar .gz

Other installation (RPM)

###创建目录
mkdir -p /home/software/ && cd /home/software/

###上传安装包
使用 rz 命令工具

###赋权
chmod 777 jdk-8u241-linux-x64.rpm

###安装(默认安装路径 /usr/java)
rpm -ivh jdk-8u241-linux-x64.rpm

###配置环境变量(请参考前面的设置)

Guess you like

Origin www.cnblogs.com/jockming/p/12222307.html