一.安装jdk
二.下载Tomcat
三.解压存储到任意目录下
四.启动Tomcat
- 打开终端
- cd 到tomcat bin所在目录
cd /Users/hrh/Library/Tomcat/apache-tomcat-9.0.0.M17\ 2/bin
- 输入sudo sh startup.sh进行启动
成功后
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.
-
用浏览器访问:http://localhost:8080/
-
失败案例与解决方法
输入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
出现这种问题的时候只需要在tomcat 的bin目录下 执行这条命令
chmod +x *.sh
再次执行 sh catalina.sh通过,然后用sh startup.sh启动成功