Java tutorial
//package com.java2s; import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; import java.util.HashMap; import java.util.Map; public class Main { public static Map<String, String> getCPUInfo() { Map<String, String> cpuInfo = new HashMap<String, String>(); Runtime runtime = Runtime.getRuntime(); try { Process process = runtime.exec("cat /proc/cpuinfo"); BufferedReader reader = new BufferedReader(new InputStreamReader(process.getInputStream())); String line; while ((line = reader.readLine()) != null) { String[] strs = line.split(":"); if (strs.length == 2) { cpuInfo.put(strs[0].trim(), strs[1].trim()); } } reader.close(); } catch (IOException e) { e.printStackTrace(); } return cpuInfo; } }