Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have just installed the openjdk-7-jdk and openjdk-7-jre packages on my Debian box that already had OpenJDK 6 installed on it. However, when I look at my Java version, I see that it shows OpenJDK 6:

bui@debian:~$ java -version
java version "1.6.0_24"
OpenJDK Runtime Environment (IcedTea6 1.11.3) (6b24-1.11.3-2)
OpenJDK 64-Bit Server VM (build 20.0-b12, mixed mode)

I did a bit of searching but found no answer on how to "replace" the old version with the new one (I did find a solution for Ubuntu but the command used there isn't available for me).

Could anyone tell me how I should proceed?

share|improve this question
What command is unavailable? update-java-alternatives? If yes, why? – Artyom Jul 24 '12 at 0:17
It doesn't exist for me. – Alex Jul 24 '12 at 1:55
On my Debian Squeeze box, it is provided by java-common package. Check if it is listed in “Installed Files” for java-common, and if it is present in /usr/sbin/. I just checked, on my box it is only available under root for some reason — maybe the situation is the same for you? – Artyom Jul 24 '12 at 2:07
Now I get this when setting the alternative: update-alternatives: error: alternative /usr/lib/jvm/java-7-openjdk-amd64/jre/lib/amd64/ for not registered, not setting. – Alex Jul 24 '12 at 2:25

The java version still shows OpenJDK 6 and not OpenJDK 7 because the defaultJDK is still pointing to OpenJDK 6. To solve this, we need to change the default JDK. The command below will help.

 sudo update-alternatives --config java
share|improve this answer

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.