How to start and stop tomcat using java code?

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

How to start and stop tomcat using java code?

5条回答
  •  离开以前
    2020-12-05 13:08

    You need to execute main method of org.apache.catalina.startup.Bootstrap with the parameter "start".

    You also need following things:

    • to have tomcat/bin/bootstrap.jar in your classpath;
    • -Dcatalina.base to point to $TOMCAT_HOME
    • -Dcatalina.home to point to $TOMCAT_HOME
    • -Djava.io.tmpdir to point to a temporary directory (usually $TOMCAT_HOME/temp)

    I also have -noverify parameter set, not sure if it is always necessary.

    p.s. it would also be nice if you could start accepting answers, your current rate is 0/28.

提交回复
热议问题