tomcat用java启动

来源:互联网 发布:阿里云是什么 编辑:程序博客网 时间:2024/05/19 05:30
  public static void main(String[] args) throws IOException {        Runtime runtime = Runtime.getRuntime();        Process process = runtime.exec("D:/tool/server/apache-tomcat-7.0.52-windows-x64/apache-tomcat-7.0.52/bin/startup.bat",null,new File("D:/tool/server/apache-tomcat-7.0.52-windows-x64/apache-tomcat-7.0.52/bin"));//        Process process = runtime.exec("startup.bat");        runtime.gc();        BufferedReader input = new BufferedReader(new InputStreamReader(process.getInputStream()));        String line = null, result = "";        while ((line = input.readLine()) != null)            result += line + "\r\n";        input.close();        System.out.println(result);        }
0 0
原创粉丝点击