To get the processor architecture, you can use the following property:
System.getProperty("sun.cpu.isalist");
It returns "amd64" since I am using an Intel 64 bit processor and Intel 64 bit is using the amd architecture.
If you need the cost of an OS architecture, you can use this os.arch property
And if you need any other property, this can help you. I wrote the following snippet to get all the properties of the system:
public static void main(String[] args) { Properties props = System.getProperties(); Enumeration<Object> keys = props.keys(); while(keys.hasMoreElements()){ Object key = keys.nextElement(); Object value = props.get(key); System.out.println("Key: "+key + " Value: "+value); } }
Muhammad Haris Altaf
source share