Get System Information under JAVA

How to get the Computer brand and model from JAVA under Windows.
private static String execCmd(String cmd) throws java.io.IOException {
        java.util.Scanner s = new java.util.Scanner(Runtime.getRuntime().exec(cmd).getInputStream()).useDelimiter("\\A");
        return s.hasNext() ? s.next() : "";
    }
    
public getSystemInfo() {
        try {
            String result=execCmd("wmic.exe computersystem get model,name,manufacturer,systemtype");
            return result;
        } catch (IOException ex) {
            
        }
        return "Not available";
    }

Comments

Popular posts from this blog

Qt Signals and Slots, Connecting and Disconnecting

Vaadin 7: Detect Enter Key in a TextField

JAVA JPA WITH HIBERNATE AND H2 Tutorial