Server Fault is a question and answer site for system and network administrators. 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 installed Ubuntu 10.04 which by default came with OpenJDK. I've since installed Sun's Java 6 using apt-get. When I type java -version I get:

java version "1.6.0_26"
Java(TM) SE Runtime Environment (build 1.6.0_26-b03)
Java HotSpot(TM) 64-Bit Server VM (build 20.1-b02, mixed mode)

However, when I start Tomcat it still appears to using Open JDK.

Using JRE_HOME:        /usr/lib/jvm/java-6-openjdk

What's the best way to globally point to Sun's Java? Is there a way to uninstall Open JDK?

share|improve this question

Have you looked at the update-alternatives command? You would use it like this: sudo update-alternatives --config java and then choose the version you want.

See the Ubuntu Java page for more details.

Hope it helps.

share|improve this answer

update-alternatives as canen mentioned is the way to go if you want to set the Java default for the whole system.

Regarding Tomcat on Ubuntu 10.04, I suggest taking a look at the Tomcat page in the Ubuntu wiki especially the paragraph titled "Changing JVM used".

In short: change the JAVA_HOME variable in /etc/default/tomcat6.

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.