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

How do I configure what JVM Eclipse runs in?

I'm trying to switch it to use my installed java-6-sun so that I can use jstack to figure out why Eclipse is spinning endlessly in certain situations.

I recently upgraded to Ubuntu 12.04, and I'm using the pre-packaged Ubuntu Eclipse 3.7.2.

I tried to adding the -vm option to eclipse.ini (immediately above the -vmargs line in my /etc/eclipse.ini), but top still shows that Eclipse is running with plain old /usr/bin/java.

The Ubuntu community wiki article for Eclipse mentions /etc/eclipse/java_home, which doesn't exist on my system.

share|improve this question
up vote 1 down vote accepted

You may already be using your preferred JVM. Please note that /usr/bin/java is not a binary, but a symlink pointing to your preferred Java JRE/JDK alternative.

I recommend changing this alternative to Sun Java 6 to avoid any confusion. For how to do that, please see this question:

How do I make java default to a manually installed JRE/JDK?

share|improve this answer
Changing the system-wide default JVM temporarily is fine for my purpose -- a couple of test runs of something on a single user system -- so I'll take it. But what I was really looking for was a way to configure Eclipse specifically. – rakslice Jul 18 '12 at 23:22

It's a good idea to download Eclipse from as the one from the Ubuntu repos is always shockingly out of date. Given Java's recent security scandals, I prefer to get the latest JDKs from the website itself and I don't need to give them root access.

So in Eclipse to change the default JVM/JRE:
Window-Preferences-Java-Installed JREs
from there you can ADD another JVM e.g version 8 etc by pointing to the JVM's location. This also where you can point to JAR libraries.

After check the default JDK:
Window-Preferences-Java-Compiler-JDK Compiler Compliance Level-as appropriate e.g 1.8

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.