Saturday, February 5, 2011

how can my java code read OS environment variables?

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?

  • Try System.getenv(String name)

    Amir Arad : yes, silly me. thanks!
    Tom Hawtin - tackline : 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.

0 comments:

Post a Comment