CentOS 7 install JAVA environment (JDK 1.8)

Uninstall the OpenJDK installed by default on CentOS

Check whether to install OpenJDK

java -version

openjdk version "1.8.0_222"
OpenJDK Runtime Environment(build 1.8.0_222-b10)
OpenJDK 64-Bit Server VM(build 25.222-b10, mixed mode)

View installation location

rpm -qa | grep java

javamail-1.4.6-8.el7.noarch
python-javapackages-3.4.1-11.el7.noarch
tzdata-java-2019b-1.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64
java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64
javassist-3.16.1-10.el7.noarch
java-1.8.0-openjdk-devel-1.8.0.222.b10-0.el7_6.x86_64

Execute statement to delete openjdk

rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.222.b10-0.el7_6.x86_64
rpm -e --nodeps java-1.8.0-openjdk-1.8.0.222.b10-0.el7_6.x86_64
rpm -e --nodeps java-1.8.0-openjdk-devel-1.8.0.222.b10-0.el7_6.x86_64

Check to delete

java -version

- bash:/usr/bin/java: No such file or directory

Install Oracle Java JDK 8

Download jdk-8u221-linux-x64.tar.gz from the official website.

After downloading, upload to the server via ftp.

Create a directory, unzip

mkdir /usr/java
tar zvxf jdk-8u221-linux-x64.tar.gz -C /usr/java

Environment configuration, modify the profile file

vi /etc/profile

Add to

export JAVA_HOME=/usr/java/jdk1.8.0_221
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar

Make environment variables take effect

source /etc/profile

Check if the configuration is successful

java -version

java version "1.8.0_221"Java(TM) SE Runtime Environment(build 1.8.0_221-b11)
Java HotSpot(TM)64-Bit Server VM(build 25.221-b11, mixed mode)

Recommended Posts

CentOS 7 install JAVA environment (JDK 1.8)
Install Java JDK8 under CentOS6
CentOS install jdk
CentOS 7 install Java 1.8
CentOS 7 install Java 1.8
CentOS8 install jdk8 / java8 tutorial (recommended)
Install Java on Centos 7
Linux Centos7 install jdk1.8
Centos6.9 install npm environment
CentOS7 install JDK8, tomcat8
Centos 7 install JDK (Linux install jdk)
CentOS install nginx+tomcat+java+mysql operating environment
CentOS6.5 install Java 8 and Tomcat8
Tencent Cloud Centos install jdk8
CentOS6.5 install Java 8 and Tomcat8
CentOS6.5 install Java 8 and Tomcat8
5.1. CentOS@ install JDK1.8 graphic tutorial
1.5 Install Centos7
How to install jdk1.8 on centOS7
CentOS 7 configure Java language development environment
Install JDK8 in rpm on CentOS7
Minimal install JDK 1.8 tutorial in CentOS 7
Tencent Cloud Centos7 install java server
How to install Java on CentOS 8
Tencent Cloud Centos7 install java server
Linux CentOS 7 install JDK detailed steps
Install java in yum mode in Centos
CentOS7 compile and install L(A|N)MP environment
Centos7 uninstall openJdk, and install JDK1.8
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
Centos7 install Python 3.6.
CentOS7 install MySQL
Centos7 install protobuf
CentOS 7 install Docker
CentOS7 install GlusterFS
CentOS 7.4 install Zabbix 3.4
Centos7.5 configuration java environment installation tomcat explanation
CentOS7 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
Vmware install CentOS6
centos7 install docker-ce 18.01.0
CentOS 7.2 install MariaDB
CentOS 7 install Hadoop 3.0.0
Centos7 install Python2.7
Centos 7.6 install seleniu
CentOS 7.3 install Zabbix3
Centos7 install LAMP+PHPmyadmin
CentOS install mysql
CentOS install openjdk 1.8
CENTOS6.5 install CDH5.12.1 (1)
CentOS install PHP
CentOS6 install mist.io
Centos7 install Docker
CentOS7 install mysql
centOs install rabbitMQ
CentOS 7 install MySQL 5.6
Centos7 install Nginx
CentOS6.5 install CDH5.13