views:

683

answers:

1

hi,

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?

+14  A: 

Try System.getenv(String name)

bruno conde
yes, silly me. thanks!
Amir Arad
Although if you are still using 1.4 (which has end of lifed, but there's still paid support available), it will throw an Error.
Tom Hawtin - tackline