I am facing a problem while trying to install Java 7 on Ubuntu.

The following are the steps that I performed for installing:

I installed the setup file from the link given below:

wget http://download.oracle.com/otn-pub/java/jdk/7u1-b08/jdk-7u1-linux-x64.tar.gz

  1. I have a file: jdk-7u1-linux-x64.tar.gz

  2. I Untared it:

    tar -xvf jdk-7u1-linux-x64.tar.gz

  3. sudo mv ./jdk1.7.0_01 /usr/lib/jvm/jdk1.7.0_01

  4. sudo update-alternatives –config java Here it gave me the following output:

    There is only one alternative in link group java: /usr/lib/jvm/java-6-sun/jre/bin/java Nothing to configure.

  5. sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_01/jre/bin/java 1(I entered 1 here.)

  6. sudo update-alternatives --config java

  7. java -version.

It showed the following output

java version "1.6.0_26"

Java(TM) SE Runtime Environment (build 1.6.0_26-b03)

Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

I am not sure if jdk1.7.0 is installed as its showing the version as 1.6.0_26.


1 Answer 1


this will install the new jvm into the java link group

sudo update-alternatives --install /usr/bin/java java /usr/lib/jvm/jdk1.7.0_01/bin/java 1

then, when you run this command again, you will see the list of JVMs that you are expecting.

sudo update-alternatives --config java

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.