在eclipse中设置引用其他环境变量的环境变量 [英] Setting environment variables in eclipse that references other environment variables
问题描述
ReportingManagerHome = C:\rp
ReportingManagerConfig = $ {ReportingManagerHome} \config
然后我运行我的程序
System.out.println(System.getenv(ReportingManagerConfig));
Eclipse甚至不调用java编译器。它抛出一个弹出窗口,其中没有定义环境变量ReportingManagerHome的错误。我明白,由于java编译器尚未被调用,技术上Eclipse是正确的。
现在我如何解决这个问题,以便我可以在Eclipse中定义级联环境变量?
它不会从启动配置递归展开环境变量。
即使使用 $ {env:VAR}
从您的eclipse进程的环境变量中取出,而不是从当前的启动配置。
最可靠的方法是转到首选项>运行/调试>字符串替换并在其中定义一个eclipse变量。
然后在启动配置中定义环境变量:
ReportingManagerHome = $ {RMH}
ReportingManagerConfig = $ {RMH} \config
I have Eclipse Helios with a java program set up. I'm attempting to create two environment variables
ReportingManagerHome=C:\rp
ReportingManagerConfig=${ReportingManagerHome}\config
I then run my program with
System.out.println(System.getenv("ReportingManagerConfig"));
Eclipse doesn't even call the java compiler. It throws up a pop up window with the error that environment variable ReportingManagerHome is not defined. I understand that since the java compiler has yet to be called, technically Eclipse is correct.
Now how do I work around this so that I can define cascading environment variables in Eclipse?
It won't recursively expand environment variables from the launch config.
Even using ${env:VAR}
takes it from the environment variables from your eclipse process, not from your current launch config.
The most reliable way to do it is to go to Preferences>Run/Debug>String Substitution and define an eclipse variable there.
Then define the environment variables in your launch config:
ReportingManagerHome=${RMH}
ReportingManagerConfig=${RMH}\config
这篇关于在eclipse中设置引用其他环境变量的环境变量的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!