How to manage Tomcat via Java

前端 未结 6 1638
温柔的废话
温柔的废话 2020-12-21 22:48

i\'m looking for a way to manage tomcat (on localhost) programmatically via java. I want to start/stop tomcat and deploy WARs.

Any help is appreciated.

6条回答
  •  心在旅途
    2020-12-21 23:00

    You can use java Runtime class to call a bat file. make sure User running java process has rights to start and stop tomcat.

    try{
    Runtime.getRuntime().exec("c:/program files/tomcat/bin/startup.bat");
    } catch(IOException e) {System.out.println("exception");}
    

提交回复
热议问题