Home  >  Article  >  Operation and Maintenance  >  How to install openJDK on CentOS

How to install openJDK on CentOS

藏色散人
藏色散人Original
2021-06-23 10:15:513050browse
This article demonstrates the installation of openJDK in CentOS
This article is a personal technical sharing, if there are any errors or omissions, please Get in touch and make changes.
Note: Server operation is performed by the root user. If there is a permission problem, please switch to the root user or grant the relevant permissions to the current user. This article will not go into details

DownloadopenJDK

wget Download

wget https://download.java.net/java/GA/jdk13.0.2/d4173c853231432d94f001e99d882ca7/8/GPL/openjdk-13.0.2_linux -x64_bin.tar.gz
How to install openJDK on CentOS

Manual download-upload to the server (when the server cannot connect to the Internet or the download is slow)

openJDK official website Or click directly to download openjdk-13.0.2_linux-x64_bin.tar.gz)
How to install openJDK on CentOS

Check whether openJDK or other versions of JDK are installed on the server, and uninstall

Executerpm -qa |grep java Check whether JDK is installed on the server, or execute java, javac, java -version
How to install openJDK on CentOS

Uninstall JDK on the server

Install openJDK

Prepare openJDK on the server. According to personal habits, copy openJDK to the specified directory. Some people like to install it in /usr/local/src directory, some people like to install it in the /opt directory

Copy the installation package to the installation path

How to install openJDK on CentOS

Installation package decompression

Execute the installation package decompression commandtar -zxvf openjdk-13.0.2_linux-x64_bin.tar.gz

How to install openJDK on CentOS

Configure environment variables

Execute vim /etc/profile, configure environment variables

ConfigurationJAVA_HOME: export JAVA_HOME=/usr/local/src/jdk-13.0.2
Add the java bin directory to the system path: export PATH=$PATH:${JAVA_HOME}/bin

How to install openJDK on CentOS

Reload environment
source /etc/profile

Verify

java -version
How to install openJDK on CentOS

The above is the detailed content of How to install openJDK on CentOS. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn