当前位置:首页 >> 服务器

Mac下安装tomcat的教程详解

1、到 apache官方主页 http://tomcat.apache.org 下载 Mac 版本的完整 tar.gz文件包。解压拷贝到 /Library 目录下,并命名为Tomcat,其他目录也可以,我这就以/Library做讲解。

2.打开终端,直接输入 sudo chmod 755 /Library/Tomcat/bin/*.sh ,按回车键之后可能会提示输入密码,请输入管理员密码,这是修改bin目录下的*.sh文件的权限

cd 到/LibraryTomcat/bin目录下,输入:sudo sh startup.sh,如果不cd进去可以直接在外面/Library/Tomcat/bin/startup.sh启动tomcat

若出现如下提示则表示运行成功:

Using CATALINA_BASE: /Library/Tomcat
Using CATALINA_HOME: /Library/Tomcat
Using CATALINA_TMPDIR: /Library/Tomcat/temp
Using JRE_HOME: /System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Home

3.打开浏览器,输入 http://localhost:8080,回车之后如果看到Apache Tomcat网址,表示已经成功运行Tomcat

4. 在终端中输入命令 sudo sh /Library/Tomcat/bin/shutdown.sh,或者直接在外面 /Library/Tomcat/bin/shutdown.sh 回车之后可以关闭Tomcat。

接下来要在Eclipse里配置tomcat

题外话:sudo通常为系统超级管理员755 代表用户对该文件拥有读,写,执行的权限,同组其他人员拥有执行和读的权限,没有写的权限,其他用户的权限和同组人员权限一样。777代表,user,group ,others ,都有读写和可执行权限。

1.先去下载个插件,Tomcat Eclipse Plugin, 下载地址:http://www.eclipsetotale.com/tomcatPlugin.html 

Last login: Wed Jul 19 08:59:29 on console
zhouqiandeMacBook-Air:~ zhouqian$ sudo chmod 755 /Library/Tomcat/bin/*.sh
Password:
chmod: /Library/Tomcat/bin/*.sh: No such file or directory
zhouqiandeMacBook-Air:~ zhouqian$ sudo chmod 755 /library/tomcat/apache-tomcat-7.0.79/bin/*.sh
zhouqiandeMacBook-Air:~ zhouqian$ cd /library/tomcat/apache-tomcat-7.0.79/bin
zhouqiandeMacBook-Air:bin zhouqian$ sudo sh startup.sh
Using CATALINA_BASE:  /Library/tomcat/apache-tomcat-7.0.79
Using CATALINA_HOME:  /Library/tomcat/apache-tomcat-7.0.79
Using CATALINA_TMPDIR: /Library/tomcat/apache-tomcat-7.0.79/temp
Using JRE_HOME:    /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Using CLASSPATH:    /Library/tomcat/apache-tomcat-7.0.79/bin/bootstrap.jar:/Library/tomcat/apache-tomcat-7.0.79/bin/tomcat-juli.jar
Tomcat started.
zhouqiandeMacBook-Air:bin zhouqian$ sudo sh /library/tomcat/apache-tomcat-7.0.79/bin/shutdown.sh
Using CATALINA_BASE:  /library/tomcat/apache-tomcat-7.0.79
Using CATALINA_HOME:  /library/tomcat/apache-tomcat-7.0.79
Using CATALINA_TMPDIR: /library/tomcat/apache-tomcat-7.0.79/temp
Using JRE_HOME:    /Library/Java/JavaVirtualMachines/jdk1.7.0_79.jdk/Contents/Home
Using CLASSPATH:    /library/tomcat/apache-tomcat-7.0.79/bin/bootstrap.jar:/library/tomcat/apache-tomcat-7.0.79/bin/tomcat-juli.jar
zhouqiandeMacBook-Air:bin zhouqian$ 

总结

以上所述是小编给大家介绍的Mac下安装tomcat的教程详解,希望对大家有所帮助,如果大家有任何疑问请给我留言,小编会及时回复大家的。在此也非常感谢大家对网站的支持!