3

Well, I've made a fresh Ubuntu 11.10 install and I installed openJDK 7. It updated alternatives just after installing, so it was all good. Then, I compiled a source and executed it and it didn't worked, then I noticed that java was using the version 1.6, while the javac was 1.7. I thought I had installed it wrong, so I uninstalled it and installed it again. But now, it does not update alternatives automatically (it does it only for javaws). Is there a way to "restart" it so the apt-get does the update-alternatives by itself like the first time? Is it normal that it uses the java 1.6 instead of the java 1.7 when installing openJDK 7?

Thank you very much!

2 Answers 2

2

To make the alternatives system decide what the "best" version is (based on the priority set during installation), run:

sudo update-alternatives --auto java
3
  • Thanks for your answer. It says there isn't alternatives for java (just after the sudo apt-get install openjdk-7-jdk command). I was looking for some solution like this. Any idea?
    – cgc512
    Mar 30, 2012 at 22:35
  • Try javac instead of java if you only have the JDK installed.
    – Lekensteyn
    Mar 31, 2012 at 10:48
  • Yes I tried both, and both say the same.
    – cgc512
    Mar 31, 2012 at 13:04
2

I've purged openjdk after uninstalling, and I reinstalled it and worked the alternatives. Then I did an update-java-alternatives to set java to version 7 (I don't know why openjdk-7-jdk sets javac to version 7 and java to version 6 but whatever, now it works). Thanks for your help.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .