Thursday, January 26, 2012

Few Easy Steps to Install Sun/Oracle JDK on EC2 Linux

I use the Amazon Linux AMI on all my EC2 instances and they come with OpenJDK IcedTea pre installed on them. I have had few issues with OpenJDK when running some applications and I always install the Sun/Oracle JDK 6 on them. Below are the few easy steps / commands to download and install JDK 6 once you log in to the EC2 instance using an SSH client.

Update:
Oracle doesn't provide direct download URLs for JDKs anymore. I have updated the steps with the trick mentioned here to get the installation file with wget

Run java -version to make sure you have the Sun/Oracle JDK as your default jvm now.



Don' forget to click the +1 button below if this post was helpful.

9 comments:

Anonymous said...

thanks for the quick post. worked perfectly.

Thomas Haines said...

NB: You now need additional steps to get the file, as Oracle requires you to accept the licence:

a) Go to download page using Firefox, click accept terms
b) Use Export Cookies add-on, to save a cookies.txt file
c) Upload cookies.txt to your instance
d) Then:
wget --load-cookies cookies.txt -O jdk-6u33-linux-i586-rpm.bin http://download.oracle.com/otn-pub/java/jdk/6u33-b03/jdk-6u33-linux-i586-rpm.bin

Anonymous said...

Thx, works for Java 7 to.

If you download the rpm (no .bin) file call:
rpm -Uvh /path/to/binary/jdk-7u5-linux-i586.rpm

Anonymous said...

Thanks for the tip !! very useful!!

jpuyy said...

I use jira and confluence.
It help a lot ,thanks

Anonymous said...

Wow! I was pulling my hairs out until I saw this post. Thank you thank you thank you!!! More specifically, standard Java library rt.jar will not function out of the box with open JDK. This works well!

mahasiswa teladan said...

hi...Im student from Informatics engineering nice article,
thanks for sharing :)

Anonymous said...

great thanks. very usefull

designing said...

thanks for this post.thanks for the useful tips