我想在文本框(GUI 面板)中显示主板序列号。我创建了一个文本框和动作按钮。我在动作按钮中编写了这段代码。我在这段代码中犯了什么错误?
try {
Process p = Runtime.getRuntime().exec("wmic baseboard get serialnumber");
BufferedReader inn = new BufferedReader(new InputStreamReader(p.getInputStream()));
while (true) {
String line = inn.readLine();
if (line == null) {
break;
}
motherboard.setText(line);
}
} catch (Exception e) {
JOptionPane.showMessageDialog(this, "Sorry could not found motherboard serial!");
}