4

I have a eclipse project which connects to different environments based on VM parameters passed in launch configuration. In order to achieve this i have set env. variables in "launch configuration -> environment" and then tried to pass them as VM argument but i get an error as eclipse is not able to resolve those env. variable.

Any guidance on how to achieve this?

2
  • Why not just pass the data as VM arguments directly? Why are you using Environment variables at all? Commented Mar 18, 2014 at 17:28
  • 2
    @E-Riz: that would mean changing 5 vm arguments and that leaves a chance of mistake Commented Mar 18, 2014 at 18:17

3 Answers 3

2

Just below "VM arguments" window there is button called "Variables". Eclipse VM args

When you click on variables it will give you an option to create new variable which can then be used in vm args as "${new_var}".

So probably we can't use env. variables as VM args in eclipse but this is a way out.

Sign up to request clarification or add additional context in comments.

Comments

0

I found the same. it seems that after added, it couldn't be removed? but I can edit it to avoid error: new_var=-Dabc=xyz

1 Comment

As it’s currently written, your answer is unclear. Please edit to add additional details that will help others understand how this addresses the question asked. You can find more information on how to write good answers in the help center.
0

Just use ${env_var:yourenvvar} in the VM parameter field.

2 Comments

this does not work? it ends up empty for me variable: arquillian_url added to vm arguments as -Darquillian.url=${env_var:arquillian_url} it makes the arquillian.url empty during runtime
bugs.eclipse.org/bugs/show_bug.cgi?id=170789 this bug describes it: env_vars that are set when starting eclipse are working, but new ones are not

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.