- Head over to Oracle JDK 8 download page (https://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html). Accept the license agreement and download the tar.gz file. It will prompt you to create an Oracle account.
- After logging into your Oracle account, you can download JDK 8. Then open up a terminal window and navigate to the download directory. Then extract the tar.gz file to /usr/lib/jvm/ directory using
sudo tar xvf jdk-8u221-linux-x64.tar.gz --directory /usr/lib/jvm/
- Now we can check Java version using
/usr/lib/jvm/jdk1.8.0_221/bin/java -version
where the Output is
java version "1.8.0_221"
Java(TM) SE Runtime Environment (build 1.8.0_221-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.221-b11, mixed mode)
- Check Java compiler version using
/usr/lib/jvm/jdk1.8.0_221/bin/javac -version
where the Output isjavac 1.8.0_221
i am using ubuntu 23.10 and this worked for me!