How to start and stop tomcat using java code?

后端 未结 5 586
感情败类
感情败类 2020-12-05 12:19

How to start and stop tomcat using java code?

5条回答
  •  清歌不尽
    2020-12-05 12:47

    For Linux Users using java, try this:

    Runtime run = Runtime.getRuntime();
    Process pr = run.exec("sh startup.sh", null, new File("filePath"));
    filePathexample = /home/example/apache-tomcat-8.0.47/bin/
    

提交回复
热议问题