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

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!

share|improve this question

2 Answers 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
share|improve this answer
    
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 '12 at 22:35
    
Try javac instead of java if you only have the JDK installed. –  Lekensteyn Mar 31 '12 at 10:48
    
Yes I tried both, and both say the same. –  cgc512 Mar 31 '12 at 13:04
up vote 1 down vote accepted

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.

share|improve this answer

Your Answer

 
discard

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.