I want to pass a VM argument in eclipse which is dependent on an environment variable.Something like this -
In Environment variables: var1=1234
In VM arguments: -Dvar2=%var1V78
This works properly without any issue using terminal but doesn't work in Eclipse
Eclipse encodes this '%' sign to '25', hence compiler is not able to find the value of 'var1' variable in 'var2'. Can anyone suggest on how to escape this '%' symbol or any other workaround.
CodePudding user response:
In the launch configuration, in the VM arguments field use the env_var variable for a value of an environment variable as follows:
-Dvar2=${env_var:var1}5678
Use the button Variables... at the bottom of the VM arguments field to get a dialog that assists you in entering variables.
Please note, the env_var variable can only be used for environment variables that are visible in the process in which Eclipse is running.
CodePudding user response:
In the launch configuration,
- select the button 'Variables' below the VM arguments field.
- On the Select Variables dialog, select 'env_var' from the list of variables. Enter Argument as 'var1'. Click 'Ok'
- Now the VM argument will have format as ${env_var:var1} and edit it to have the format '-Dvar2=${env_var:var1}5678'
