How to install JDK 11 on an AWS linux instance

#!/usr/bin/env bash
cd /usr/local/src
wget --no-cookies --header "Cookie: gpw_e24=xxx; oraclelicense=accept-securebackup-cookie;" http://download.oracle.com/otn-pub/java/jdk/11.0.1+13/90cf5d8f270a4347a95050320eef3fb7/jdk-11.0.1_linux-x64_bin.tar.gz
tar xzf jdk-11.0.1_linux-x64_bin.tar.gz
rm -rf jdk-11.0.1_linux-x64_bin.tar.gz
mv /usr/local/src/jdk-11.0.1 /usr/local/jdkv10
alternatives --install /usr/bin/java java /usr/local/jdkv11/bin/java 2
alternatives --install /usr/bin/jar jar /usr/local/jdkv11/bin/jar 2
alternatives --install /usr/bin/javac javac /usr/local/jdkv11/bin/javac 2
alternatives --set jar /usr/local/jdkv11/bin/jar
alternatives --set javac /usr/local/jdkv11/bin/javac
export JAVA_HOME=/usr/local/jdkv11
export PATH=$PATH:/usr/local/jdkv11/bin
  • Save it as:
install-jdk11.sh
  • Give it execution permission with
chmod +x install-jdk11.sh
  • Run it with sudo:
sudo ./install-jdk11.sh

Published by

juanmacias

Software developer with a passion for Scala, football, tennis, photography, travelling, playing the guitar, learning languages (real ones), and hacking around.

2 thoughts on “How to install JDK 11 on an AWS linux instance”

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.