lxw
2023-08-15 160e150009b51a39fa95d9462c3798ba28d51a09
src/main/java/com/whyc/util/SerialNumberUtil.java
@@ -17,11 +17,11 @@
    public static String getCPUNumber(){
        String os = System.getProperty("os.name").toLowerCase();
        System.out.println(os);
        //System.out.println(os);
        Process process = null;
        String serial = null;
        if(os.contains("window")) {
            System.out.println("windows");
            //System.out.println("windows");
            try {
                process = Runtime.getRuntime().exec(
                        new String[]{"wmic", "cpu", "get", "ProcessorId"});
@@ -38,7 +38,7 @@
            }
        }else{
            //linux
            System.out.println("linux");
            //System.out.println("linux");
            serial =getSerialNumber("dmidecode -t processor | grep 'ID'", "ID",":");
        }
@@ -46,6 +46,10 @@
    }
    /**
     * 集成在主板Bios上的操作系统UUID
     * @return
     */
    public static String getBoisNumber(){
        String os = System.getProperty("os.name").toLowerCase();
        Process process = null;
@@ -108,7 +112,7 @@
    /**linux*/
    public static String executeLinuxCmd(String cmd)  {
        try {
            System.out.println("got cmd job : " + cmd);
            //System.out.println("got cmd job : " + cmd);
            Runtime run = Runtime.getRuntime();
            Process process;
            process = run.exec(cmd);