Java displays the current runtime parameter of the Java run parameter

  • 2020-04-01 03:15:08
  • OfStack

Displays the various parameters of the runtime where the Java code is currently running.

No String operations.


package systeminfo;
import java.util.Iterator;
import java.util.Map.Entry;
import java.util.Properties;

public class sysinfo {
 public static void main(String[] args) {
  Properties p = System.getProperties();
  Iterator<Entry<Object, Object>> it= p.entrySet().iterator();
  while(it.hasNext()){
   Entry<Object,Object> item=it.next();
   System.out.print(item.getKey()+"===");
   System.out.println(item.getValue());
  }
 }
}

Simple version


package systeminfo;
public class sysinfo {
 public static void main(String[] args) {
  String s = System.getProperties().toString();
  System.out.println(s);
        }
}

The String version


package systeminfo;

public class sysinfo {
 public static void main(String[] args) {

  String s = System.getProperties().toString();
  System.out.println(s);

  String[] ss=s.split(",");
  for(String e:ss){
  System.out.println(e);
  }
 }
}


Related articles: