Find Out What Jvm Eclipse Is Running On

Find out what JVM Eclipse is running on

Actually, Windows->Preferences->Java->installed doesn't show you the one Eclipse runs under, but only the default JRE that it runs things under.

To see the one Eclipse is runing under, go to Help->About Eclipse Platform->Configuration Details, and look for the property eclipse.vm.

For example:

eclipse.vm=C:\Program Files\Java\jre6\bin\client\jvm.dll

What version of Java is running in Eclipse?

The one the eclipse run in is the default java installed in the system (unless set specifically in the eclipse.ini file, use the -vm option). You can of course add more Java runtimes and use them for your projects

The string you've written is the right one, but it is specific to your environment. If you want to know the exact update then run the following code:

public class JavaVersion {
public static void main(String[] args) {
System.out.println(System.getProperty("java.runtime.version"));
}
}

Eclipse JVM configuration

See:

  • eclipse.ini for 3.4 or
  • eclipse.ini for 3.5

for an example of parameters order.

-vm should be before -vmargs


Update 6 years laters (2015)

E Riz mentions in the comments that the new Eclipse Installer will detect the JVM for you, or propose ones to download.

https://www.eclipse.org/downloads/assets/public/images/installer-instructions-04.png

How do I change my Eclipse IDE's launch JVM?

In the reference documentation we learn (basic) details on how the Eclipse launcher executable looks for suitable Java installations:

-vm (Executable, Main)

when passed to the Eclipse executable, this option is used to locate the Java VM to use to run Eclipse. It should be the full file system path to an appropriate: Java jre/bin directory, Java Executable, Java shared library (jvm.dll or libjvm.so), or a Java VM Execution Environment description file.

If not specified, the Eclipse executable uses a search algorithm to locate a suitable VM. In any event, the executable then passes the path to the actual VM used to Java Main using the -vm argument. Java Main then stores this value in eclipse.vm.

Sadly, the result of that "search algorithm" is not explicitly specified which somehow makes it "a bit" non-deterministic. Even more complicating: It might be a strategy which is platform dependent.

EDIT: In the section Eclipse Launcher the algorithm is explained better, providing more details.

When no -vm is specified, the launcher looks for a virtual machine first in a jre directory in the root of eclipse and then on the search path.

Given the above "jvm search" process and (the related) implications, you can (only) have a stable environment by specifying a path via -vm in eclipse.ini. This should point to the "stable" path as returned by the command /usr/libexec/java_home -v 1.8*.

*Note: Simply, check the result of this command via a Terminal locally.

In my MacOS environment the above command results in:

/Library/Java/JavaVirtualMachines/1.8.0.jdk/Contents/Home

As you can see in the next listing, I created a symlink which points to the actual and up2date JDK as installed on in my system.

node:JavaVirtualMachines user$ ls -lah
total 0
drwxr-xr-x 6 root wheel 192B 18 Jan 13:35 .
drwxr-xr-x 5 root wheel 160B 6 Okt 14:28 ..
lrwxr-xr-x 1 root wheel 17B 18 Jan 13:34 1.8.0.jdk -> jdk1.8.0_161.jdk/
lrwxr-xr-x 1 root wheel 14B 3 Nov 10:42 1.9.0.jdk -> jdk-9.0.1.jdk/
drwxr-xr-x 3 root wheel 96B 3 Nov 10:40 jdk-9.0.1.jdk
drwxr-xr-x 3 root wheel 96B 18 Jan 13:32 jdk1.8.0_161.jdk

Investigating your question further, I came along with an interesting observation in my local Eclipse Oxygen.2 installation which might also apply in your case. In the below screenshot we see, that the JRE name is somehow "static" and not updated with new versions.

JRE name mismatch

Verify your local situation by clicking the "Edit..." button in the Installed JRE list. It might actually point to an up2date JRE/JDK version. In the best case you just have to adjust the name of this entry.

Hope it helps.

Eclipse cannot find JVM

Your -vm argument should be listed before your -vmargs arguments:

-vm
C:\Program Files\Java\jre7\bin

-vmargs

-Dosgi.requiredJavaVersion=1.6

-Xms40m

-Xmx512m

See http://wiki.eclipse.org/Eclipse.ini#Specifying_the_JVM.

Cant find Java VM to add in Eclipse

You can find where your Java installation lives with this command:

$ readlink -f $(which java)

On my Fedora Linux workstation it results in:

/usr/lib/jvm/java-11-openjdk-11.0.13.0.8-2.fc35.x86_64/bin/java

So the directory is /usr/lib/jvm/java-11-openjdk-11.0.13.0.8-2.fc35.x86_64

However you will notice that directory has a very specific version in the path. This is undesirable because it will change when java is updated and might break your Eclipse configuration.

But good news: When I look in my /usr/lib/jvm directory there is a versionless symlink on my system which points (eventually) to the same place: /usr/lib/jvm/java-11-openjdk

I would use the versionless symlink because then my Eclipse configuration will not break when java gets updated. Hopefully it is similar on Debian.

How to find the JVM version from a program?

System.getProperty("java.version") returns what you need.

You can also use JMX if you want:

ManagementFactory.getRuntimeMXBean().getVmVersion()

Running Eclipse on Mac - JVM Version 1.7 or greater is required

Simply Install the JDK 7 or JDK 8, and not just the latest JRE.



Related Topics



Leave a reply



Submit