Linux安装oracle jdk

jdk8下载地址:Java Archive Downloads - Java SE 8 (oracle.com)

 

##安装oracle linux时自带的jdk

[root@mylinux7 ~]# java -version
openjdk version "1.8.0_262"
OpenJDK Runtime Environment (build 1.8.0_262-b10)
OpenJDK 64-Bit Server VM (build 25.262-b10, mixed mode)
[root@mylinux7 ~]# which java
/usr/bin/java

 

##卸载原有的openJdk

[root@mylinux7 jdk1.8.0_202]# rpm -qa | grep java
java-1.8.0-openjdk-1.8.0.262.b10-1.el7.x86_64
javassist-3.16.1-10.el7.noarch
tzdata-java-2020a-1.el7.noarch
java-1.7.0-openjdk-1.7.0.261-2.6.22.2.0.1.el7_8.x86_64
java-1.7.0-openjdk-headless-1.7.0.261-2.6.22.2.0.1.el7_8.x86_64
python-javapackages-3.4.1-11.el7.noarch
javamail-1.4.6-8.el7.noarch
java-1.8.0-openjdk-headless-1.8.0.262.b10-1.el7.x86_64
javapackages-tools-3.4.1-11.el7.noarch
[root@mylinux7 jdk1.8.0_202]# yum remove *openjdk*

 

##在最下面加入

 vi /etc/profile

#java
export JAVA_HOME=/usr/local/lib/jdk1.8.0_202
export CLASSPATH=.:$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lib/dt.jar
export PATH=$PATH:$JAVA_HOME/bin

 

 

###生效环境变量

[root@mylinux7 jdk1.8.0_202]# source /etc/profile
[root@mylinux7 jdk1.8.0_202]# java -version
java version "1.8.0_202"
Java(TM) SE Runtime Environment (build 1.8.0_202-b08)
Java HotSpot(TM) 64-Bit Server VM (build 25.202-b08, mixed mode)

posted on 2022-09-29 09:35  兔哥DB  阅读(140)  评论(0编辑  收藏  举报

导航