Skip to content

Instantly share code, notes, and snippets.

@rtfpessoa
Last active March 21, 2022 14:46
Show Gist options
  • Save rtfpessoa/17752cbf7156bdf32c59 to your computer and use it in GitHub Desktop.
Save rtfpessoa/17752cbf7156bdf32c59 to your computer and use it in GitHub Desktop.
[Guide] Install Oracle Java (JDK) 8 on Amazon EC2 Ami

First verify the version of Java being used is not Sun Java 8 SDK

java -version

Check the latest version a build numbers in http://www.oracle.com/technetwork/java/javase/downloads/index.html

For url http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-linux-x64.tar.gz, the variables should be defined as:

java_base_version="8"
java_sub_version="11"
java_base_build="14"

java_version="${java_base_version}u${java_sub_version}"
java_build="b${java_base_build}"
java_version_with_build="${java_version}-${java_build}"

Get the Sun Java 8 SDK from Oracle

wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/${java_version_with_build}/jdk-${java_version}-linux-x64.rpm"

Install Sun Java 8

sudo rpm -i jdk-${java_version}-linux-x64.rpm

Check if the default java version is set to Sun Java 8 SDK

java -version

If not then lets create one more alternative for Sun Java 8 SDK

sudo /usr/sbin/alternatives --install /usr/bin/java java /usr/java/jdk1.${java_base_version}.0_${java_sub_version}/bin/java 20000

Set the Sun Java 8 SDK as the default java

sudo /usr/sbin/alternatives --config java

Verify if change in SDK was done

java -version

Add the export of the java home to your .bashrc, .bash_profile, .zshrc, or any other relevant file.

export JAVA_HOME=/usr/java/default

@albogdano
Copy link

albogdano commented Nov 16, 2017

JDK 9.0.1

wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" \
"http://download.oracle.com/otn-pub/java/jdk/9.0.1+11/jdk-9.0.1_linux-x64_bin.rpm

@m1schka
Copy link

m1schka commented Feb 8, 2018

8u151 doesn't work anymore, here is the new one for 8u162:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" "http://download.oracle.com/otn-pub/java/jdk/8u162-b12/0da788060d494f5095bf8624735fa2f1/jdk-8u162-linux-x64.rpm"

@khoi-thinh
Copy link

khoi-thinh commented Apr 24, 2018

@m1schka This doesn't work anymore.
New one for 8u172

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u172-b11/a58eab1ec242421181065cdc37240b08/jdk-8u172-linux-x64.rpm

@smurty
Copy link

smurty commented May 26, 2018

for 8u171 use:
wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u171-b11/512cd62ec5174c3487ac17c61aaa89e8/jdk-8u171-linux-x64.rpm

@timoa
Copy link

timoa commented Jul 24, 2018

for 8u181 use:

wget --no-cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" 
http://download.oracle.com/otn-pub/java/jdk/8u181-b13/96a7b8442fe848ef90c96a2fad6ed6d1/jdk-8u181-linux-x64.rpm

@trepidity
Copy link

JRE 8u191

wget --cookies --no-check-certificate --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie" http://download.oracle.com/otn-pub/java/jdk/8u191-b12/2787e4a523244c269598db4e85c51e0c/jre-8u191-linux-x64.rpm

@xuanchuong
Copy link

great
you saved the day.

@pipeu
Copy link

pipeu commented Jan 7, 2019

Tks @trepidity !

@anandmuthu-vnix
Copy link

JDK 8u201

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" https://download.oracle.com/otn-pub/java/jdk/8u201-b09/42970487e3af4f5aa5bca3f542482c60/jdk-8u201-linux-x64.rpm

@tehPlayer
Copy link

JDK 8u251-b08 [2020-04-29]

wget --no-check-certificate --no-cookies --header "Cookie: oraclelicense=accept-securebackup-cookie;" https://download.oracle.com/otn-pub/java/jdk/8u251-b08/3d5a2bb8f8d4428bbe94aed7ec7ae784/jdk-8u251-linux-x64.rpm

@dhananjaybhakte
Copy link

I am getting following output after executing below command.

wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" "http://download.oracle.com/otn-pub/java/jdk/8u74-b02/jdk-8u74-linux-x64.rpm"

HTTP request sent, awaiting response... 301 Moved Permanently
Location: https://download.oracle.com/otn-pub/java/jdk/8u74-b02/jdk-8u74-linux-x64.rpm?AuthParam=1594561344_c05993b0def6cd0fb7206876e1b671a9 [following]
--2020-07-12 13:40:24-- https://download.oracle.com/otn-pub/java/jdk/8u74-b02/jdk-8u74-linux-x64.rpm?AuthParam=1594561344_c05993b0def6cd0fb7206876e1b671a9
Connecting to download.oracle.com (download.oracle.com)|184.87.216.29|:443... connected.
HTTP request sent, awaiting response... 404 Not Found
2020-07-12 13:40:24 ERROR 404: Not Found.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment