jhasse
jhasse

Reputation: 2593

Tell eclipse to reload environment variables

I'm setting an environment variable in a .bat file using set and setx which is executed by my java application.

But the next time I run my application the environment variables are back to their old values - I have to restart Eclipse for the changes to take effect.

How can I tell eclipse to reload environment variables each time I run my application?

Upvotes: 8

Views: 7059

Answers (3)

Ahmed Nabil
Ahmed Nabil

Reputation: 18966

How can I tell eclipse to reload environment variables each time I run my application?

Yes, You can easily define/simulate your Environment variables configurations during running the application inside Eclipse without need to restart it + without need to update them externally from your system:
Using Run Configurations...

enter image description here enter image description here

Upvotes: 0

noor
noor

Reputation: 1691

You can exit and start your eclipse instead of restarting it. It should just work fine then.

Upvotes: 10

Ulf Jaehrig
Ulf Jaehrig

Reputation: 749

Environment variables set with "set" are set for the current process and its children. If you leave the process, the values are lost.

The "setx" command sets an environment variable in the system environment. But the values are read into the process only on restart. So eclipse still has the old environment variables and started processes will inherit these.

Upvotes: 4

Related Questions