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?


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

wget http://www.java.net/download/jdk7u40/archive/b40/binaries/jdk-7u40-fcs-bin-b40-linux-i586-16_aug_2013.tar.gz

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

wget http://www.java.net/download/jdk7u40/archive/b40/binaries/jdk-7u40-fcs-bin-b40-linux-x64-16_aug_2013.tar.gz

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.

  • 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 – rɑːdʒɑ 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 – rɑːdʒɑ Sep 4 '13 at 2:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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