Accessing Windows system variables in Java 1.4 -
What is the best / easiest way to get the values of environment variables in Windows when using J2SE 1.4?
You definitely have no way to reach the environment variable from the Java API. Runtime with such code. The only way to gain with XAC:
process p = null; Runtime R = Runtime. Tot Timetime (); String OS = System.getProperty ("os.name"). ToLowerCase (); // System.out.println (OS); If (OS index ("Windows 9")> gt; -1) {p = r.exec ("command.com / c set"); } And ((OS.indexOf ("nt")> gt; -1) (OS.indexOf ("windows 2000")> 1) (OS.indexOf ("windows xp") & Gt; - 1)) {// Thank you for Xenfran for Xand Fix! P = r.exec ("cmd.exe / c set"); }
Although you can use Java variables to thank you for system .getProperties (); But you only have some NV variables mapped by JVM, and additional data that you can provide with the "-KK = value" on the Java command line
For more information
< / Div>
Comments
Post a Comment