Sign up ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

I know that latest official openJDK is java version "1.7.0_25". But there is java version "1.7.0_40" in development. Does anyone know how to install openJDK "1.7.0_40" on an Ubuntu machine?

share|improve this question

1 Answer 1

up vote 4 down vote accepted

If you want openJDK 1.7.0_40 for 32-bit Ubuntu then do as


If you want openJDK 1.7.0_40 for a 64-bit Ubuntu then do as


Then make a directory.

sudo mkdir -p /usr/lib/jvm

Then move the downloaded tar to above created directory with

sudo mv jdk-7u40-fcs-bin-b40-linux-i586-16_aug_2013.tar.gz /usr/lib/jvm

similarly you can move 64-bit also if you want.

Then cd that directory

cd /usr/lib/jvm

Then untar the archive with


  sudo  tar -xvf jdk-7u40-fcs-bin-b40-linux-i586-16_aug_2013.tar.gz


  sudo  tar -xvf jdk-7u40-fcs-bin-b40-linux-x64-16_aug_2013.tar.gz

Then paste these line one by one , and these are for intimating Ubuntu that this is your default java and path of it.

sudo update-alternatives --install "/usr/bin/javac" "javac" "/usr/lib/jvm/jdk1.7.0_40/bin/javac" 1
sudo update-alternatives --install "/usr/bin/java" "java" "/usr/lib/jvm/jdk1.7.0_40/bin/java" 1

sudo update-alternatives --set "javac" "/usr/lib/jvm/jdk1.7.0_40/bin/javac"
sudo update-alternatives --set "java" "/usr/lib/jvm/jdk1.7.0_40/bin/java"

Then update your system profile , open it with

sudo gedit /etc/profile

then paste these lines

export JAVA_HOME
export PATH

Now save & close.

Then reload your profile with

.  /etc/profile

Then we are done. check your java version.

share|improve this answer
Ya. I was able to find and download it. But how to install it? – RoboAlex Sep 4 '13 at 1:53
@Braiam my dear brother ,I am little bit slow at typing. :P – Raja Sep 4 '13 at 1:58
Hahaha, so you are striving for being the fastest answerer in the west? ;) – Braiam Sep 4 '13 at 2:03
@Braiam shhhhh!!! dont reveal the truths , its public :P :P – Raja Sep 4 '13 at 2:08

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.