Centos 7 install JDK (Linux install jdk)

Centos 7 install JDK (Linux install jdk)

In the first part, first check whether there is openjdk in centos 7. If not, skip the first part and go to the second part.

[ master@bogon ~]$ java -version
openjdk version "1.8.0_65"
OpenJDK Runtime Environment(build 1.8.0_65-b17)
OpenJDK 64-Bit Server VM(build 25.65-b01, mixed mode)

1.0 Query sources that contain java###

[ master@bogon ~]$ rpm -qa | grep java
python-javapackages-3.4.1-11.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
tzdata-java-2015g-1.el7.noarch
javapackages-tools-3.4.1-11.el7.noarch

1.1 Delete as root###

[ master@bogon ~]$ rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
Error: can't create transaction lock on/var/lib/rpm/.rpm.lock(Insufficient permissions)[master@bogon ~]$ su
password:

1.2 Successfully deleted###

[ root@bogon master]# rpm -e --nodeps java-1.8.0-openjdk-headless-1.8.0.65-3.b17.el7.x86_64
[ root@bogon master]# rpm -e --nodeps java-1.7.0-openjdk-1.7.0.91-2.6.2.3.el7.x86_64
[ root@bogon master]# rpm -e --nodeps java-1.8.0-openjdk-1.8.0.65-3.b17.el7.x86_64
[ root@bogon master]# rpm -e --nodeps java-1.7.0-openjdk-headless-1.7.0.91-2.6.2.3.el7.x86_64
[ root@bogon master]# rpm -e --nodeps tzdata-java-2015g-1.el7.noarch

The second part install jdk The default jdk file has been extracted to /opt

2.0 Configure environment variables###

[ root@bogon opt]# vim /etc/profile.d/java.sh

2.1 Write ### in vim

JAVA_HOME=/opt/jdk1.8.0_72
JRE_HOME=/opt/jdk1.8.0_72/jre
CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib/tools.jar:$JRE_HOME/lib:$CLASSPATH
PATH=$JAVA_HOME/bin:$PATH

2.2 Variables take effect###

[ root@bogon opt]# source /etc/profile.d/java.sh

2.3 Check whether the installation is successful (if there is a problem, check whether the file path is accurate)

[ root@bogon opt]# java -version
java version "1.8.0_77"Java(TM) SE Runtime Environment(build 1.8.0_77-b03)
Java HotSpot(TM)64-Bit Server VM(build 25.77-b03, mixed mode)[root@bogon opt]#

Recommended Posts

Linux Centos7 install jdk1.8
Centos 7 install JDK (Linux install jdk)
CentOS install jdk
Linux CentOS 7 install JDK detailed steps
CentOS (linux) install PostgreSQL
CentOS7 install JDK8, tomcat8
Know Linux and install CentOS
CentOS 7 install JAVA environment (JDK 1.8)
Linux Centos7 install redis tutorial
Install MySQL 8.0.16 on Linux Centos
Install MySQL under Linux (CentOS 7)
1.5 Install Centos7
Centos 7 install jdk and package service service
How to install jdk1.8 on centOS7
Minimal install JDK 1.8 tutorial in CentOS 7
CentOS8 install jdk8 / java8 tutorial (recommended)
Install MySQL on Linux CentOS7 (Windows)
Centos7 uninstall openJdk, and install JDK1.8
​Install Oracle database on CentOS Linux
Linux CentOS6 compile and install Pyt
Use VMware15 to install Linux (CentOS6.5)
Centos6 install Python2.7.13
Centos7.3 install nginx
CentOS7.2 install Mysql5.7.13
CentOS install Redmine
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 install Docker
Centos6.5 install Tomcat
CentOS install Python 3.6
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
Linux01 install centOS6.5mini
CentOS6 install mist.io
CentOS7 install mysql
CentOS 7 install MySQL 5.6
CentOS6.5 install CDH5.13
Centos7 install docker18
Centos install Python3
centos7 install docker
centos7 install nginx-rtmp
CentOS8 install MySQL8.0
Centos6.3 install KVM
CentOS install PostgreSQL 9.1
CentOS7 install mysql8
CentOS 7 install Java 1.8
Centos7 configure JDK
CentOS8 install fastdfs6.06