Search code examples
eclipsejvm-arguments

How to reference a JVM variable in eclipse.ini


I would like to specify a custom value for java.io.tmpdir in eclipse.ini file. Specifically, I need to have a username as part of the path.

I see the following entry in my eclipse.ini:

-Dosgi.instance.area.default=@user.home/eclipse-workspace

But when I try to use similar lines for my purpose:

-Djava.io.tmpdir=/tmp/eclipse_@user.name
-Djava.io.tmpdir=/tmp/eclipse_{@user.name}
-Djava.io.tmpdir=/tmp/eclipse_@{user.name}
-Djava.io.tmpdir=/tmp/@user.name

I end up with the following directories (literally):

/tmp/eclipse_@user.name
/tmp/eclipse_{@user.name}
/tmp/eclipse_@{user.name}
/tmp/@user.name

How could I specify my -D option so that @user.name is substituted with the actual username (e.g., john_doe)?


Solution

  • The eclipse.ini does not support variable substitution.

    The @user.home and @user.dir substitution is done by the Equinox location code and consequently is only supported for the Equinox location values which are:

    osgi.install.area
    osgi.configuration.area
    osgi.configuration.area.default
    osgi.instance.area
    osgi.instance.area.default
    osgi.user.area
    osgi.user.area.default
    

    The code that does this is org.eclipse.osgi.internal.location.EquinoxLocations