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

Popular posts from this blog

c++ - Linux and clipboard -

Visual Studio 2005: How to speed up builds when a VSMDI is open? -

booting ubuntu from usb using virtualbox -