# vi /etc/profile
#java
export JAVA_HOME=/usr/java/jdk1.8.0_152
export PATH=$JAVA_HOME/bin:$PATH
export CLASSPATH=.:$JAVA_HOME/lib/dt.jar:$JAVA_HOME/lib
[root@ecs-7bc6-0001 ~]# source /etc/profile
[root@ecs-7bc6-0001 ~]# java -version
java version "1.8.0_152"
Java(TM) SE Runtime Environment (build 1.8.0_152-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.152-b16, mixed mode)
nohup java -server -Dloader.path=./lib -Xms256m -Xmx512m -jar $RUN_NAME >/dev/null 2>&1 &
nohup /java/jdk1.8.0_152/bin/java -server -Dloader.path=./lib -Xms256m -Xmx512m -jar $RUN_NAME >/dev/null 2>&1 &
[root@ecs-7bc6-0001 ~]# yum search java|grep jdk
[root@ecs-7bc6-0001 ~]# yum install java-1.8.0-openjdk
[root@ecs-7bc6-0001 ~]# java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
[root@ecs-7bc6-0001 ~]# sudo apt update
[root@ecs-7bc6-0001 ~]# sudo apt search openjdk
[root@ecs-7bc6-0001 ~]# sudo apt install openjdk-8-jdk
[root@ecs-7bc6-0001 ~]# java -version
openjdk version "1.8.0_352"
OpenJDK Runtime Environment (build 1.8.0_352-8u352-ga-1~20.04-b08)
OpenJDK 64-Bit Server VM (build 25.352-b08, mixed mode)
[root@ecs-7bc6-0001 ~]# sudo apt-get update
[root@ecs-7bc6-0001 ~]# sudo apt-get install default-jdk
[root@ecs-7bc6-0001 ~]# java -version
openjdk version "11.0.18" 2023-01-17
OpenJDK Runtime Environment (build 11.0.18+10-post-Debian-1deb10u1)
OpenJDK 64-Bit Server VM (build 11.0.18+10-post-Debian-1deb10u1, mixed mode, sharing)