// this works
if ("Show".equals (obj))
{
try {
String command= "/usr/bin/xterm -e javac panel_1.java";
Runtime rt = Runtime.getRuntime();
Process pr = rt.exec(command);
BufferedReader in = new BufferedReader(new InputStreamReader(pr.getInputStream()));
String line = null;
while ((line = in.readLine()) != null) {
System.out.println(line);
}
} catch (IOException e) {
e.printStackTrace();
}
}
这将打开一个 xterm 窗口,在 panel_1.java 上调用 javac,如果 panel_1.java 是一个有效文件,它就会编译。然后 xterm 窗口关闭。很好,我想从编译中获取警告等,并将它们放在列表或文本区域中。有任何想法吗???