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.

I have both java-6-openjdk and java-7-openjdk installed on my machine. When I check the version, I get java version "1.6.0_27". I want to run java 7 but don't really know what all I have to change to accomplish the change.

Is it as simple as changing the link from /etc/alternatives/java -> /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java /etc/alternatives/java -> /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java?

share|improve this question

1 Answer 1

You can use sudo update-alternatives --config java to change the version of Java that is used. Don't manually change the linking of anything in /etc/alternatives/java. This is described well in Changing JVM in Java.

Alternatively, if you don't plan on using Java 6 in the future, you can remove Java 6 in its entirety. Running sudo apt-get purge openjdk-6-jre openjdk-6-jre-headless should work. If you also installed the JDK, the package name of that is openjdk-6-jdk.

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.