Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

This question already has an answer here:

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

marked as duplicate by Mitch, theDefector, Eric Carvalho, Anwar Shah, Andrea Corbellini Sep 4 '13 at 15:20

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

I have updated my answer.eye it. –  Raja Sep 4 '13 at 1:56

1 Answer 1

up vote 3 down vote accepted

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.

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

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