问题
This may be a very simple problem, but I couldn't find an answer googleing and I'm in a rush - so I'd appreciate fast code examples.
I have an environment variable on the OS I would like to read using Java code. I've tried System.getProperty
, but that only seems to work for the -D
variables supplied directly for the JVM.
How can my Java code read OS variables?
回答1:
Try System.getenv(String name)
来源:https://stackoverflow.com/questions/461018/how-can-my-java-code-read-os-environment-variables