老爷爷赶鹅曲谱:在JAVA程序中如何调用 系统函数

来源:百度文库 编辑:中科新闻网 时间:2024/04/29 13:50:26
请问各位,如何在编写JAVA程序中调用系统函数,如关机了,打开光区了等等。
程序我试了,进入死循环不出来。

<%@page import = "java.io.*"%>
<%@page import="java.lang.*"%>
<html>
<head><title>dos</title></head>
<table>
<tr><td>
<%
Runtime r=Runtime.getRuntime();
Process p = r.exec("D:\\resin-2.1.16\\webapps\\test\\a.bat");
while (true){
if(p.waitFor() == 0) break;
}

%>

</td></tr>
<table>
</html>

java调用dos命令

b z d

考虑一下继承