Last Updated on 11/11/2020
This tutorial will show how to change Eclipse JRE path, in order to force Eclipse to use the specified JVM.
This is a very useful approach if you need your Eclipse running over a different JVM than the one specified on your PATH environment variable, or even if this variable absent. Also, it is going to help you with portable JREs and to solve the No Java Virtual machine was found
error.
In your Eclipse folder, you should have a file named eclipse.ini, which looks like the following on a fresh downloaded Eclipse Mars:
-startup plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms256m -Xmx1024m
Note the highlighted line which specify -vmargs
, we must specify our JRE path above it, otherwise it is not going to work.
To specify our JRE, we add the following on the said location:
-vm <your_java_home>\bin\javaw.exe
And here’s the modified version of the eclipse.ini file pointing to a different JVM on my machine:
-startup plugins/org.eclipse.equinox.launcher_1.3.100.v20150511-1540.jar --launcher.library plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.300.v20150602-1417 -product org.eclipse.epp.package.java.product --launcher.defaultAction openFile --launcher.XXMaxPermSize 256M -showsplash org.eclipse.platform --launcher.XXMaxPermSize 256m --launcher.defaultAction openFile --launcher.appendVmargs -vm C:\Users\bgasparotto\Documents\Java\jdk1.8.0_60\bin\javaw.exe -vmargs -Dosgi.requiredJavaVersion=1.7 -Xms256m -Xmx1024m
Hope it helps. Cya!