Java library for get information about your machine. Information about Operating System, CPU, Memory, Net, Disk, Network, Services and Process
For use this library,
you call class of package: it.carminepat.systeminfo.
All class implement singleton pattern. For example, call instance of Os (operating system information) class: it.carminepat.systeminfo.Os.i();
All object is ready for json format translation.
ObjectMapper mapper = new ObjectMapper();
System.out.println(mapper.writeValueAsString(Os.i()));
- Os (mac,windows)
- CPU (mac,windows)
- Memory (windows)
- Net (windows)
- Disk (windows)
- Services (windows)
- Process (windows)
- Program (windows)
{
"name":"Mac OS X",
"version":"10.15.3",
"arch":"x86_64",
"country":"IT",
"language":"it",
"displayCountry":"Italia",
"displayLanguage":"italiano",
"displayTimeZone":"Ora dell'Europa centrale",
"timeZone":"Europe/Rome",
"displayDateTime":"08/03/2020 17:34:10",
"hostName":"iMac.local",
"serialNumber":"XXXXXXX0X000",
"hardwareUUID":"000000-XXXXXX-000000",
"lastBootTime":"08/03/2020 10:50:00",
"fullName":"Mac OS X 10.15.3"
}
Other method of class:
- String getEnvironmentVariable(String s)
- Map<String, String> getEnvironmentVariables()
- setEnvironmentVariable(String key, String value)
- addToEnvironmentVariable(String key, String value)
- void restart()
- void restartAfterSeconds(int seconds)
- void shutdown()
- void shutdownAfterSeconds(int seconds)
{
"processorName":"Quad-Core Intel Core i7",
"processorSpeed":"4,2 GHz",
"numberOfProcessors":1,
"numberOfCores":4,
"l3cache":"8 MB",
"l2cache":"256 KB"
}
{
"physicalTotalInstalled":"7,90 GB",
"physicalFree":"1,93 GB",
"physicalInUse":"5,97 GB",
"virtualTotalInstalled":"12,61 GB",
"virtualFree":"1,52 GB",
"virtualInUse":"11,08 GB"
}
{
"localIpAddress":"11x.168.0.x",
"publicIP":"xxx.xxx.xxx.xxx",
"listNetwork":[
{
"description":"Broadcom NetXtreme Gigabit Ethernet",
"deviceId":1,
"macAddress":"XX:XX:XX:XX:XX:XX",
"manufacturer":"Broadcom",
"name":"Broadcom NetXtreme Gigabit Ethernet",
"netConnectionId":"Ethernet",
"productName":"Broadcom NetXtreme Gigabit Ethernet",
"serviceName":"b57nd60a"
}
]
}
Other method:
{"disks":[{
"name":"C:",
"volumeName":"ABSTRACT",
"serial":"XXXX0000",
"description":"DISCO RIGIDO LOCALE",
"fileSystem":"NTFS",
"freeSpace":"5,27 GB",
"size":"47,46 GB"
},{
"name":"D:",
"volumeName":null,
"serial":"XOXOXOXO",
"description":"DISCO RIMOVIBILE",
"fileSystem":"FAT32",
"freeSpace":"3,52 GB",
"size":"7,48 GB" }]
}
Method Services.i().getListOfServices(); return a List of SingleService object. SingleProcess object is composed from this property:
boolean acceptStop;
String caption;
String displayName;
String name;
String pathName;
int PID;
boolean started;
String startMode;
String status;
String state;
[{
"acceptStop":false,
"caption":"Servizio router AllJoyn",
"displayName":"Servizio router AllJoyn",
"name":"AJRouter",
"pathName":"C:\\Windows\\system32\\svchost.exe -k LocalServiceNetworkRestricted -p",
"started":false,
"startMode":"Manual",
"status":"OK",
"state":"Stopped",
"pid":0
}, {
"acceptStop":false,
"caption":"Servizio Gateway di livello applicazione",
"displayName":"Servizio Gateway di livello applicazione",
"name":"ALG",
"pathName":"C:\\Windows\\System32\\alg.exe",
"started":false,
"startMode":"Manual",
"status":"OK",
"state":"Stopped",
"pid":0
}, {...} ...]
Method Process.i().getListOfProcess(); return a List of SingleProcess object. This List is ordered by memory use desc. SingleProcess object is composed from this property:
String name;
int pid;
String nameSession;
int sessionNumber;
String momory;
[{
"name":"netbeans64.exe",
"pid":11056,
"nameSession":" Console",
"sessionNumber":1,
"momory":"1,21 GB"
}, {
"name":"chrome.exe",
"pid":7100,
"nameSession":" Console",
"sessionNumber":1,
"momory":"476,35 MB"
}, {...},
.
.
.
]
with this method: Process.i().getListOfProcessByName("chrome"); filter process by String "name", for example "chrome". It return List of SingleProcess object.
[{
"name":"chrome.exe",
"pid":7100,
"nameSession":" Console",
"sessionNumber":1,
"momory":"462,08 MB"
}, {
"name":"chrome.exe",
"pid":3132,
"nameSession":" Console",
"sessionNumber":1,
"momory":"354,26 MB"
}, {...},
.
.
.
]
with this method: Process.i().getProcessByPid(7100); filter process by his PID. It return an instance of SingleProcess object.
{
"name":"chrome.exe",
"pid":7100,
"nameSession":" Console",
"sessionNumber":1,
"momory":"480,15 MB"
}
with this method: Process.i().getListOfProcessByUser("username"); filter process by username.
with this method: Process.i().getListOfFirstFiveProcess(); filter first five process ordered by use of memory desc.
with this method: Process.i().getListOfProcessMemoryGTMb(MegaBytesNumber); filter list of process use great than memory specified in MegaBytes.
with this method: Process.i().killTask(PID); kill process with specified PID
information about software application installed in OS.
[{
"description":"Java 7 Update 79 (64-bit)",
"installationDate":"10/03/2020",
"installLocation":"C:\\Program Files\\Java\\jre7\\",
"installState":"5",
"name":"Java 7 Update 79 (64-bit)",
"packageCache":"C:\\Windows\\Installer\\46785.msi",
"vendor":"Oracle",
"version":"7.0.790",
"identifyingNumber":"{26A24AE4-039D-4CA4-87B4-2F06417079FF}"
},{
"description":"Java 8 Update 73 (64-bit)",
"installationDate":"13/03/2020",
"installLocation":"C:\\Program Files\\Java\\jre1.8.0_73\\",
"installState":"5",
"name":"Java 8 Update 73 (64-bit)",
"packageCache":"C:\\Windows\\Installer\\520de2.msi",
"vendor":"Oracle Corporation",
"version":"8.0.730.2",
"identifyingNumber":"{26A24AE4-039D-4CA4-87B4-2F86418073F0}"
}, {...}, ...]