Easily install Oracle JDK8 on your EC2 instance

Mert Çalışkan
1 min readJul 25, 2015

--

Amazon’s AMI ships with OpenJDK. When you run java -version on an instance of AMI with id: ami-a8221fb5, you get the details as:

java version “1.7.0_75”
OpenJDK Runtime Environment (amzn-2.5.4.0.53.amzn1-x86_64 u75-b13)
OpenJDK 64-Bit Server VM (build 24.75-b04, mixed mode)

To upgrade to the latest and greatest, just follow the instructions given below. First let’s download the goodness from Oracle, the JDK 8u51. Tricks needed with the cookie part stated as parameters since we’re downloading via wget.

sudo wget --no-cookies --no-check-certificate --header “Cookie: gpw_e24=http%3A%2F%2Fwww.oracle.com%2F; oraclelicense=accept-securebackup-cookie” “https://download.oracle.com/otn-pub/java/jdk/8u51-b16/jdk-8u51-linux-x64.rpm"

Do replace quotation marks after copying the command from here. medium.com replaces them with a different version.

Then install the rpm easily with the command:

sudo rpm -ivh jdk-8u51-linux-x64.rpm

After the installation you should be seeing the exact details given as follows by executing java -version.

java version “1.8.0_51”
Java(TM) SE Runtime Environment (build 1.8.0_51-b16)
Java HotSpot(TM) 64-Bit Server VM (build 25.51-b03, mixed mode)

--

--

Mert Çalışkan

Opsgenie Champion at Atlassian. Oracle Java Champion. AnkaraJUG Lead. Author of Beginning Spring & PrimeFaces Cookbook.