how do i get an OS environment variable from Java code?
How do I get an OS environment variable from java code?An env. variable in unix: SET BLAH=BLAHIn Windows: SET BLAH=BLAHHow get this variable? (Java makes you set one: CLASSPATH)
[212 byte] By [
6tr6tr] at [2007-9-26 4:47:25]

Right AFAIK, all you have to do is call System.getProperty(String OSvariable)OSvariable is a string to indicate which OS variable you are talking about E.g. PATH, CLASSPATH etc.The method returns a string that points to the contents of that variable.Hope this helps
ph0b05 at 2007-6-29 18:37:08 >

Some variables you can?t get this way.
I made shellscript that just looked like this.
set > /yourdir/yourfile.txt
Then in my class I did Runtime.exec(shellxcript);
then you just read in "/yourdir/yourfile.txt" as Resource and load it in
a Property object.
After that you can get variables to.
Bnarva at 2007-6-29 18:37:08 >
