Uninstall openJDK and install JDK under Linux

Uninstall openJDK

1、查看系统自带的jdk具体的软件包信息
	 rpm -qa | grep jdk

Insert picture description here

2、卸载命令:
	yum -y remove java-1.7.0-openjdk.x86_64 
	yum -y remove java-1.7.0-openjdk-headless.x86_64 

OK, that's it, don't worry, just install the new JDK happily.

Install JDK

1. Download the installation package from the official website and upload it to the server.
2. Unzip the installation package to the specified directory:
tar -zxvf jdk-8u231-linux-x64.tar.gz -C /opt/lagou/servers/
3. Set the environment variables
Add
# java_home
export JAVA_HOME=/opt/lagou/servers/jdk1.8.0_231/
export PATH= PATH: PATH: at the end of vim /etc/profile :PATH: JAVA_HOME/bin
4. Save and exit and execute: source /etc/profile
5. Test java -version is
Insert picture description here
over,,,,,,

Guess you like

Origin blog.csdn.net/weixin_44796239/article/details/108149557