Home > Article > Operation and Maintenance > How to install jdk in centos system
First download jdk on the jdk download page. Remember centos7 only supports 64-bit jdk, so you need to be careful when downloading to ensure that the number of downloaded jdk bits is correct
Use linux management client ssh secure shell, upload the jdk8 you just downloaded and press subcontract, as shown in the figure below
(recommended tutorial : centos usage tutorial)
Go to the uploaded directory and use the ll command to view the file list
Use the command
tar -zxvf jdk-8u181-linux-x64.tar.gz
Extract the compressed package to the current directory
After decompression is successful, use the ll command to view the file list. The compressed package is decompressed into the jdk1.8.0_181 folder
Configure environment variables and modify the /etc/profile file
Add the following environment variables, the code is as follows
JAVA_HOME=/usr/java/jdk1.8.0_181 CLASSPATH=$JAVA_HOME/lib/ PATH=$PATH:$JAVA_HOME/bin export PATH JAVA_HOME CLASSPATH
Reload the /etc/profile configuration file, the command is
source /etc/profile
Check whether jdk is installed and configured successfully, the command is as follows
java -version
Print java version information
Recommended related video tutorials: linux video tutorial
The above is the detailed content of How to install jdk in centos system. For more information, please follow other related articles on the PHP Chinese website!