Install Oracle JDK6 in Amazon Linux AMI

Gabriel Zhang September 15, 2014

Download Oracle JDK6

You can download Oracle JDK6 from this link: jdk-6u45-linux-x64.bin, choose jdk-6u45-linux-x64.bin and accept license agreement, because this is a old version of Oracle JDKs, so you need input your authorization information before you download it.

Install Oracle JDK6

After you download it, you can run the following command to extract the bin file:

sudo chmod u+x jdk-6u45-linux-x64.bin
sudo ./jdk-6u45-linux-x64.bin

Then you should create one more alternative for Java, /opt/jdk/ is your jdk home path:

sudo ln -s jdk1.6.0_45/ jdk
sudo alternatives --install /usr/bin/java java /opt/jdk/bin/java 20000

Then you can set the default java in this Amazon Linux AMI:

sudo /usr/sbin/alternatives --config java

For now you can input java -version command to check your jdk version information.