Last active
January 8, 2019 19:12
-
-
Save krishnact/315614e2dc402c31893733423fe7747e to your computer and use it in GitHub Desktop.
How to get CPU ID in Java?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
use following dependency: | |
<dependency> | |
<artifactId>oshi-core</artifactId> | |
<groupId>com.github.oshi</groupId> | |
<version>3.11.0</version> | |
</dependency> | |
and use this code: | |
public static String getCPUId() { | |
oshi.SystemInfo si = new oshi.SystemInfo(); | |
String procId = si.getHardware().getProcessor().getProcessorID() ; | |
return procId; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment