//如不能运行,请正确配置tomcat环境
public class conTomCat{
public void close() throws IOException
{
Process process = Runtime.getRuntime().exec('cmd /c D:\\apache-tomcat-7.0.16\\bin\\shutdown.bat')// 调用外部程序
final InputStream in = process.getInputStream()
BufferedReader br=new BufferedReader(new InputStreamReader(in))
StringBuilder buf = new StringBuilder()
String line = null
while((line = br.readLine()) != null)
buf.append(line)
System.out.println('输出结果为:' + buf)
}
启动
public void start() throws IOException
{
Process process = Runtime.getRuntime().exec('cmd /c D:\\apache-tomcat-7.0.16\\bin\\startup.bat')// 调用外部程序
final InputStream in = process.ge tInputStream()
BufferedReader br=new BufferedReader(new InputStreamReader(in))
StringBuilder buf = new StringBuilder()
String line = null
while((line = br.readLine()) != null)
buf.append(line)
System.out.println('输出结果为:' + buf)
}
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)