Java Installation on Ubuntu Linux



sudo apt install openjdk-24-jdk-headless


$ javac -version
javac 24-ea

$ java --version
openjdk 24-ea 2025-03-18
OpenJDK Runtime Environment (build 24-ea+16-Ubuntu-1)
OpenJDK 64-Bit Server VM (build 24-ea+16-Ubuntu-1, mixed mode, sharing)

An older version


$ javac -version
javac 1.8.0_252

$ java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (build 1.8.0_252-8u252-b09-1ubuntu1-b09)
OpenJDK 64-Bit Server VM (build 25.252-b09, mixed mode)