How to deploy war file to tomcat using command prompt?

后端 未结 8 878
慢半拍i
慢半拍i 2021-01-30 11:05

I have created a war file and put into tomcat/webapps. How to deploy a war file to tomcat using command prompt?

8条回答
  •  时光取名叫无心
    2021-01-30 11:44

    To do this, we need to place the WAR file inside the Tomcat CATALINA_HOME/WEBAPPS/ directory. Later, Tomcat will automatically deploy and explode this WAR file.

    • Change active directory of command prompt to your WAR file location
    • Set CATALINA_HOME variable to the path of the Tomcat directory
    • Copy the WAR files

    Syntax to copy the WAR file from the current directory in the command line:

    copy  %CATALINA_HOME%\
    

    Example:

    cd C:\MY_WAR_FILE_LOCATION
    set CATALINA_HOME="C:\Program Files\Apache\apache-tomcat-7.0.42"
    copy MYWARFILE.WAR %CATALINA_HOME%\webapps
    

    Note: If a WAR file is copied into the webapps directory while Tomcat is running, it will not be recognized. Simply restart Tomcat to begin using the web application.

提交回复
热议问题