Java 8 application on EC2

check Java current version

java -version

install Java 1.8

sudo yum install java-1.8.0

change the Java version

sudo alternatives --config java

Java 8 may not be available out-of-the-box on the AMI that you are looking for. However, you can always install it once the instance is created.

e.g. Check this post which explains how to install java 8 on Ubuntu OR check this post which explains how to install Java 8 on RHEL/Fedora/CentOS.


Installing JDK 8:

Step 1: Check the Java Version

     java -version

Step 2: Download RPM package of Oracle JDK (8u121)

     wget --no-check-certificate --no-cookies --header "Cookie:oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u141-b15/336fa29ff2bb4ef291e347e091f7f4a7/jdk-8u141-linux-x64.rpm

Step 4: Install JDK 8

     sudo yum install -y jdk-8u141-linux-x64.rpm

Step 5: Verify oracle JDK version

     java -version

Installing JRE 1.8

   sudo yum install java-1.8.0

change the Java version

  sudo alternatives --config java