Linux installs JDK online, command download
Online download JDK
command: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.rpm
Download reading bar: When the progress bar is 100%, the download is complete
Check whether there is a JDK installation package in the current folder:
Add execution permission:
First, let’s explain the meaning of the three letters rwx: r stands for readable and accessible; w stands for writable and modifiable; x stands for
executable Access and modify, but not execute
② Part 2 r – Belongs to the group to which the file belongs, means this user group can access, but cannot modify and execute
③ Part 3 r – Belongs to other users, means other users can only access this file or directory, but cannot be modified or executed.
④ Use - to indicate that there is no permission.
We need to add executable permissions to ourselves
. Command: chmod +x jdk-8u131-linux-x64.rpm
Execute rpm to install
Command: rpm -ivh jdk-8u131-linux-x64.rpm
Check whether JDK is successfully installed at this time
Command:java -version
Check the installation path of JDK, (general default path: /usr/java/jdk1.8.0_131)
Configure JDK environment variables
1. Edit environment variables
export JAVA_HOME=/usr/java/jdk1.8.0_131
export JRE_HOME=${
JAVA_HOME}/jre
export CLASSPATH=.:${
JAVA_HOME}/lib:${
JRE_HOME}/lib:$CLASSPATH
export JAVA_PATH=${
JAVA_HOME}/bin:${
JRE_HOME}/bin
export PATH=$PATH:${
JAVA_PATH}
2. Edit the /etc/profile
command:vim /etc/profile
3. Perform environment configuration
Command: i Enter edit mode
Paste the edited above and
enter the command:wq!
Force save and exit
to make the profile take effect immediately:source /etc/profile
Check the JDK installation status
1. Use the javac command, there will be no command not found
2. Command:java -version
3. Check whether the environment variable configuration you just set is correct
Command:echo $PATH
yum install jdk
1. Check if JDK is installed, uninstall
yum list installed |grep java
java-1.8.0-openjdk.x86_64 1:1.8.0.121-0.b13.el7_3 @updates
java-1.8.0-openjdk-headless.x86_64 1:1.8.0.121-0.b13.el7_3 @updates
javapackages-tools.noarch 3.4.1-11.el7 @base
python-javapackages.noarch 3.4.1-11.el7 @base
tzdata-java.noarch 2016j-1.el7 @updates
2 Uninstall the CentOS system Java environment
[root@abc ~]# yum -y remove java-1.8.0-openjdk* *表时卸载所有openjdk相关文件输入
[root@abc ~]# yum -y remove tzdata-java.noarch 卸载tzdata-java
[root@192 ~]# yum -y remove java-1.8.0-openjdk* *表时卸载所有openjdk相关文件输入
[root@192 ~]# yum -y remove tzdata-java.noarch 卸载tzdata-java
3 list java environment installation packages
yum -y list java*
或 [root@abc ~]# yum search java | grep -i --color JDK 查看JDK软件包列表
yum install java-1.8.0-openjdk java-1.8.0-openjdk-devel
安装JDK,如果没有java-1.8.0-openjdk-devel就没有javac命令