Using Eclipse with its local Version of Java Virtual Machine

Eclipse is probably the most used and de-facto standard IDE for any development for ARM Cortex or any other devices. It is very easy these days to construct an unlimited and unrestricted IDE (see “Breathing with Oxygen: DIY ARM Cortex-M C/C++ IDE and Toolchain with Eclipse Oxygen“). Up to the point that I can pack it into a .zip file and pass it around e.g. in a class room environment, so no installer at all is needed with the exception of the debug probe USB drivers. As Eclipse is using a Java Virtual Machine (VM), it is a good idea to bundle the VM with the IDE, and this article is about how to do this.

Eclipse Oxygen running with its own Java Virtual Machine

Eclipse Oxygen running with its own Java Virtual Machine

First, I need to find the Java VM. Usually it is already installed on the host machine (otherwise install it from https://java.com). Usually on Windows it is in

c:\Program Files\Java

or I can use the Java control panel and the ‘View’ button to see where it is running:

Path to Java

Path to Java

Copy that Java folder into the Eclipse folder:

Local Java VM inside Eclipse

Local Java VM inside Eclipse

Open the Eclipse.ini and add the following two lines right after –launcher.appendVmargs:

-vm
Java/jre1.8.0_144/bin/javaw.exe
Using local VM in Eclipse.ini

Using local VM in Eclipse.ini

Then launch Eclipse. I can check which Java VM is used using the Help > About menu item. Clicking in the dialog on the ‘Installation Details’ gives me the Java VM used:

Configuration Details

Configuration Details

That’s it! I’m running now Eclipse with a local Java VM and do not depend on one installed otherwise on the host :-).

That of course potentially duplicates the Java VM on a machine. But on the other end it makes the Eclipse IDE very self-contained which is a good thing in many ways.

Happy Javing 🙂

Advertisements

6 thoughts on “Using Eclipse with its local Version of Java Virtual Machine

  1. Hi Erich
    I agree, it’s very convenient to have everything in one zip. But on the other hand there’s also a potential security risk. Eclipse may/will open connections to remote internet servers. There may be (well there certainly is) a bug in the wm, which may be used to do nasty things on you computer. Now it’s your responsibility to maintain the bundled java, otherwise you can rely on your IT department (I’m not saying they to a better job…)

    Like

      • With a standard install of the Oracle JRE on Windows, or the default JRE provided with a Linux distro, the user will be offered updates and the opportunity to remove older versions of the JRE. Oracle strongly recommends that older versions are uninstalled (even though the older versions will no longer be the default JRE): https://www.java.com/en/download/faq/remove_olderversions.xml

        If a provider bundles a JRE with an Eclipse-based product, the provider should assume responsibility for keeping that JRE up to date.

        Like

    • Yes, we basically came to the conclusion that we should bundle the Java VM with Eclipse because some students had 64bit Windows, but for some reasons only 32bit Jave VM installed on their system. With the VM bundled we can avoid this kind of issues.

      Like

  2. Oracle strongly recommends that older versions are uninstalled (even though the older versions will no longer be the default JRE): Now it’s your responsibility to maintain the bundled java, otherwise you can rely on your IT department (I’m not saying they to a better job…)

    Like

What do you think?

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s