Saturday, August 29, 2009

VM Arguments in Eclipse

Eclipse.ini has been explained in detail here. It is used to control the Eclipse start up. This text file will contain the options that can also be provided from command line when invoking Eclipse.

Two of them are -vm and -vmargs. These and other such arguments have been explained here in detail.

-vm <path to java vm> (Executable, Main)
This is the path to the JRE/JDK which will be used to run Eclipse. Eclipse supports Java 1.42 and above. The path should be absolute. The path should point to the bin folder but can also point to java.exe, java lib folder or the Java VM execution environment description file (whatever that is). The path should follow  -vm and should one the separate line right after it.

C:\Program Files\IBM\Java50\bin

This path is copied to eclipse.vm and can be accessed at runtime using System.getProperty("eclipse.vm").

-vmargs [vmargs*] (Executable, Main)
These are arguments are passed as is to JVM. Used to configure JVM that would run Eclipse. This should be last argument in eclipse.ini as anything that follows it is passed to JVM and eclipse doesn't bothers about it. Again, the value is available as system property "eclipse.vmargs" at runtime.

A typical eclipse.ini will have -Xms and -Xmx following the -vmargs. They define the minimum and maximum heap size respectively. Again, each argument has to be defined on a separate line.


This means the JVM launching Eclipse will have minimum heap size of 40 MB and a max of 256MB.

Target Definition
The target definition editor or wizard has an Arguments tab. This page has a section which deals with VM Arguments. The VM Arguments specified here are used to initialize the Run configurations. This section has an Import... button which produces an Import Arguments dialog. The import argument dialog scans the selected bundle containers and presents the VM Arguments from them. They do have no effect on build.

Run Configuration

The run configurations generally have an Arguments tab. This tab has a section for VM Arguments. Values specified here are sent to the JVM while launching.

The Eclipse Application Run Configuration defaults the VM Arguments from the active target platform.


  1. [...] to create launch configurations. One such setting is the VM Arguments (discussed in more detail here). The VM Arguments are used to tune the JVM and one of the most commonly used arguments are -Xms [...]

  2. Anonymous12:27 PM

    I am trying to use this system property for the first time and trying to access the vmarg in my code. like say i have in my eclipse.ini file

    whenever i try to access using system.getProperty("server.address")
    its always returning null.
    The problem could be very small but dont know how to resolve can someone please help

  3. System.getProperty("server.address") shall work. I see no issues over there. What may be going wrong is one of these

    1. In eclipse.ini the entry -Dserver.address=http://localhost shall appear in the very end (to be safe n sure). If you misplace it it won't work.

    2. If you are launching guest eclipse then the -D entry shall go in the VM Args of the Launch config.