4

Does anyone know how to specify what jvm eclipse will launch itself with when it switches workspace? If I start eclipse with an eclipse.ini containing:

-vm Library/Java/JavaVirtualMachines/jdk1.7.0_17.jdk/Contents/Home/bin/java

eclipse launches with that jre. The console output confirms this:

5/14/13 4:01:16.932 PM [0x0-0x51b51b].org.eclipse.eclipse: eclipse.buildId=M20130204-1200 5/14/13 4:01:16.932 PM [0x0-0x51b51b].org.eclipse.eclipse: java.version=1.7.0_17 5/14/13 4:01:16.932 PM [0x0-0x51b51b].org.eclipse.eclipse: java.vendor=Oracle Corporation

When I switch the workspace though for some reason it launches itself with a 1.6 jvm.

5/14/13 4:07:51.596 PM [0x0-0x51b51b].org.eclipse.eclipse: eclipse.buildId=M20130204-1200 5/14/13 4:07:51.597 PM [0x0-0x51b51b].org.eclipse.eclipse: java.version=1.6.0_45 5/14/13 4:07:51.597 PM [0x0-0x51b51b].org.eclipse.eclipse: java.vendor=Apple Inc.

This is a problem as our plugins that require 1.7 consquently fail to load. This is on OSX 10.7.5 but it also happens on 10.8.

JAVA_HOME points to the 1.7 jvm and /usr/bin/java is also symlinked to the 1.7 jvm. /usr/bin appears near the head of my PATH and in fact its the only java on my path. I'm guessing that eclipse must assume that the "best" jvm is the one in /System/Library/Frameworks/JavaVM.framework/Versions/Current or /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK and that points 1.6.

2 Answers 2

2

This is a bug in Eclipse, see https://bugs.eclipse.org/bugs/show_bug.cgi?id=396552

I'm not aware of any work-arounds for this, but you could try setting the JAVA_JVM_VERSION environment variable.

The bug report indicates that the problem has been fixed, you could try a more recent milestone, or you can try grabbing the binaries that were attached to the bug.

0

We have plugins that require Java 7. I dont use the eclipse.ini method because it gets overwritten during various Eclipse Updates. Instead, we put a folder named "jre" inside the Eclipse folder and it will automatically use that one for JVM. I switch workspaces all the time using File -> Switch Workspace without problems.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.