方法1:
byte[] env = new byte[1000];
try{
Process ObjPrcess = ObjRunTime.exec("cmd /c echo %java_home%");
InputStream in = ObjPrcess.getInputStream();
in.read(env);
String ls_env = new String(env).trim();
System.out.println("ls_env:"+ls_env);
}catch(Exception e){e.printStackTrace();}
方法2:
public class GetSysProperties{
public static void main(String[] argv) {
System.getProperties().list(System.out);
}
}