Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

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 installed openjdk-7-jdk, "javac" was version 7 but "java" was still version 1.6, any way around this? No updates are available.

share|improve this question

It's because the javac file in /usr/bin is still linking to your previous jdk. So you have to using update-alternative to configure it.

share|improve this answer
sudo update-alternatives --config java – medigeek Dec 23 '11 at 15:52

You can use

$ sudo update-java-alternatives -l

to get the list of JVMs and then use

$ sudo update-java-alternatives -s NAME

to set the one you want. It may warn about some missing links, in which case you'll need to install the missing package and run update-java-alternatives again.

share|improve this answer
When I run sudo update-java-alternatives -s java-7-oracle, it gives me : " update-alternatives: error: no alternatives for update-alternatives: error: alternative /usr/lib/jvm/java-7-oracle/jre/bin/jexec for jexec not registered, not setting. update-alternatives: error: alternative /usr/lib/jvm/java-7-oracle/jre/lib/amd64/ for not registered, not setting. update-alternatives: error: no alternatives for " What is the matter? I use ubuntu12.04 amd64. – waterloo2005 Jan 18 '13 at 8:12

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.