2

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.

2 Answers 2

1

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?

1
  • 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, 2012 at 23:22
0

It's a good idea to download Eclipse from https://www.eclipse.org/downloads/ 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 http://www.oracle.com/technetwork/java/javase/downloads/index.html 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

You must log in to answer this question.

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