windows 告诉 eclipse 重新加载环境变量
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/8491863/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Tell eclipse to reload environment variables
提问by jhasse
I'm setting an environment variable in a .bat file using set
and setx
which is executed by my java application.
我在 .bat 文件中设置了一个环境变量set
,setx
它由我的 java 应用程序执行。
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.
但是下次我运行我的应用程序时,环境变量会恢复到它们的旧值 - 我必须重新启动 Eclipse 才能使更改生效。
How can I tell eclipse to reload environment variables each time I run my application?
每次运行应用程序时,如何告诉 eclipse 重新加载环境变量?
采纳答案by Ulf Jaehrig
Environment variables set with "set" are set for the current process and its children. If you leave the process, the values are lost.
使用“set”设置的环境变量是为当前进程及其子进程设置的。如果您离开该过程,则这些值将丢失。
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.
“setx”命令在系统环境中设置环境变量。但是这些值仅在重新启动时才被读入进程。因此 eclipse 仍然具有旧的环境变量,并且启动的进程将继承这些。
回答by noor
You can exit and start your eclipse instead of restarting it. It should just work fine then.
您可以退出并启动 eclipse 而不是重新启动它。那么它应该可以正常工作。
回答by ahmednabil88
How can I tell eclipse to reload environment variables each time I run my application?
每次运行应用程序时,如何告诉 eclipse 重新加载环境变量?
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...
是的,您可以在 Eclipse 内运行应用程序期间轻松定义/模拟您的环境变量配置,而无需重新启动它+无需从系统外部更新它们:
使用Run Configurations...