[英]how to run java application with environment variables loading from file?
I'm building java ( jdk 8
) application.我正在构建 java (
jdk 8
) 应用程序。
I want to run the application (run/debug mode) from my IDE ( Intellij IDEA
).我想从我的 IDE (
Intellij IDEA
) 运行应用程序(运行/调试模式)。
My application use some environment variables.我的应用程序使用了一些环境变量。
I know I can add the environment variables one by one in the Run/Debug configurations -> environment variables.我知道我可以在运行/调试配置->环境变量中一一添加环境变量。
Right now there is no choice like that in IDEs.现在在 IDE 中没有这样的选择。 We have to manually feed all those stuffs in the Run/Debug configuration.
我们必须在运行/调试配置中手动提供所有这些内容。 If you want you can add it as part of your gradle / maven from there you can do all those expected functionalitites and configure that task in the Run/Debug configuration.
如果您愿意,可以从那里将其添加为 gradle/maven 的一部分,您可以执行所有这些预期的功能并在运行/调试配置中配置该任务。 That only will solve your problem.
那只会解决你的问题。
There is no direct way to do this.没有直接的方法可以做到这一点。
The only things that comes to my mind is:我想到的唯一事情是:
If you don't want to use it from directly from IDE you can code:如果您不想直接从 IDE 使用它,您可以编写代码:
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.