Bootstrap FreeKB - Java - Set Java Runtime Environment (JRE) in Eclipse
Java - Set Java Runtime Environment (JRE) in Eclipse

Updated:   |  Java articles

Almost always, you will be deploying your Java application to an application server such as JBoss, Tomcat, or WebSphere. When possible, I like to ensure that Eclipse is configured with the same Java Runtime Environment (JRE) as the application server. For example, if the application server is using Java Runtime Environment 8u311 then I would download and install Java Runtime Environment 8u311 on my system running Eclipse.

To be absolutely certain that Eclipse is being run on a certain Java Runtime, you can updated eclipse.ini with the -vm option.

  • The -vm option and its value (the path to the javaw.exe file) must be on separate lines
  • The value must be the full absolute or relative path to the javaw.exe file
  • The -vm option must occur after the other options and before the -vmargs option
  • For 32-bit Eclipse a 32-bit version of Java must be used - Or 64-bit Java for 64-bit Eclipse
-startup
plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar
--launcher.library
plugins/org.eclipse.equinox.launcher.win32.win32.x86_64_1.1.551.v20171108-1834
-product
org.eclipse.epp.package.jee.product
-showsplash
org.eclipse.epp.package.common
--launcher.defaultAction
openFile
--launcher.defaultAction
openFile
--launcher.appendVmargs
-vm
C:\Program Files\Java\JDK8u332-B09\bin\javaw.exe
-vmargs
-Dosgi.instance.area.default=@user.home/eclipse-workspace
-XX:+UseG1GC
-XX:+UseStringDeduplication
-Xms256m
-Xmx1024m
--add-modules=ALL-SYSTEM

 

Or, you could do the following to set the Java Runtime Environment.

  1. Go to Window > Preferences > Java > Installed JREs
  2. Select Add
  3. Select Standard VM > Next
  4. Directory will be something like C:\Program Files\Java\jre1.8.0_311 and JRE name will be something like jre1.8.0_311 > Finish
  5. Check mark the new Java Runtime Environment > Apply and Close

You may want to:




Did you find this article helpful?

If so, consider buying me a coffee over at Buy Me A Coffee



Comments


Add a Comment


Please enter 087f62 in the box below so that we can be sure you are a human.