OpenJDK 17 : Install2023/07/14 |
Install OpenJDK 17.
|
|
[1] | Install OpenJDK 17 and run a test program. |
root@dlp:~#
apt -y install openjdk-17-jdk
root@dlp:~#
cat > /etc/profile.d/java.sh <<'EOF'
export JAVA_HOME=$(dirname $(dirname $(readlink $(readlink $(which java))))) export PATH=$PATH:$JAVA_HOME/bin EOF
root@dlp:~#
root@dlp:~# source /etc/profile.d/java.sh
java --version openjdk 17.0.7 2023-04-18 OpenJDK Runtime Environment (build 17.0.7+7-Debian-1deb12u1) OpenJDK 64-Bit Server VM (build 17.0.7+7-Debian-1deb12u1, mixed mode, sharing) # verify to create test program
root@dlp:~# cat > java_test.java <<'EOF'
class java_test {
public static void main(String[] args) {
System.out.println("Hello Java World !");
}
}
EOF
root@dlp:~# javac java_test.java root@dlp:~# java java_test Hello Java World ! |