Install Tomcat on Mac

1. Install jdk

2. Download Tomcat

Path: http://tomcat.apache.org/download-90.cgi 
The first zip is preferred

3. Unzip and store in any directory

4. Start Tomcat

  • open terminal 
  • cd to the directory where the tomcat bin is located 
    cd /Users/hrh/Library/Tomcat/apache-tomcat-9.0.0.M17\ 2/bin
  • Enter sudo sh startup.sh to start
    successfully

    Using CATALINA_BASE:   /Users/huruihua/Library/Tomcat

    Using CATALINA_HOME:   /Users/huruihua/Library/Tomcat

    Using CATALINA_TMPDIR: /Users/huruihua/Library/Tomcat/temp

    Using JRE_HOME:        /Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home

    Using CLASSPATH:       /Users/huruihua/Library/Tomcat/bin/bootstrap.jar:/Users/huruihua/Library/Tomcat/bin/tomcat-juli.jar

    Tomcat started.

  • Access with a browser: http://localhost:8080/

  • Failure cases and solutions
    The following prompt appears after entering sudo sh startup.sh

    Cannot find ./catalina.sh

    The file is absent or does not have execute permission

    This file is needed to run this

    program

    Execute this command
    chmod +x *.sh   in the bin directory of tomcat and
    execute sh catalina.sh again to pass,

    Then use sh startup.sh to start successfully


Commemorate a heart-wrenching day

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326274581&siteId=291194637