Setting environment variables in eclipse that references other environment variables

15,251

It won't recursively expand environment variables from the launch config.

Even using ${env:VAR} takes it from the environment variables from your eclipse process, not from your current launch config.

The most reliable way to do it is to go to Preferences>Run/Debug>String Substitution and define an eclipse variable there.

Then define the environment variables in your launch config:

ReportingManagerHome=${RMH}
ReportingManagerConfig=${RMH}\config
Share:
15,251
fidesachates
Author by

fidesachates

Updated on June 28, 2022

Comments

  • fidesachates
    fidesachates almost 2 years

    I have Eclipse Helios with a java program set up. I'm attempting to create two environment variables

    ReportingManagerHome=C:\rp
    ReportingManagerConfig=${ReportingManagerHome}\config

    I then run my program with

    System.out.println(System.getenv("ReportingManagerConfig"));

    Eclipse doesn't even call the java compiler. It throws up a pop up window with the error that environment variable ReportingManagerHome is not defined. I understand that since the java compiler has yet to be called, technically Eclipse is correct.

    Now how do I work around this so that I can define cascading environment variables in Eclipse?

  • mrtumnus
    mrtumnus almost 8 years
    ${env:VAR} should be ${env_var:VAR}, at least in Eclipse Mars.