mac下启动tomcat

先说一下自己遇到的情况:下载了mac版本的tomcat,配置完conf文件夹下面的service.xml后,双击了bin下面的startup.bat文件,结果tomcat并没有启动,而是以sublime形式打开了。那么问题是什么,为什么会出现这种情况?

查阅资料发现,.bat文件属于windows下面的批处理文件,在win系统下可以双击打开,但是mac下批处理文件是.sh文件,即为shell脚本,所以原来用于win系统下面的打开方式是不对的。那么现在说一下如何在mac下面启动tomcat操作步骤:

      在介绍具体步骤之前,先说一下mac下打开指定目录的终端操作方法[我是mac小白,大神请绕行...]:

      1、打开终端。

      2、复制需要打开文件的路径,比如:/Users/cxh/Documents/apache-tomcat-7.0.73/bin。

      3、输入:cd  /Users/cxh/Documents/apache-tomcat-7.0.73/bin,回车即进入tomcat的bin目录下面。


1、进入tomcat的bin目录下

Last login: Mon Dec  5 11:05:02 on ttys000

cxhdeMacBook-Air:~ cxh$ cd /Users/cxh/Documents/apache-tomcat-7.0.73/bin

2、输入pwd,回车

cxhdeMacBook-Air:bin cxh$ pwd

/Users/cxh/Documents/apache-tomcat-7.0.73/bin

3、输入sudo chmod 755 *.sh,回车

cxhdeMacBook-Air:bin cxh$ sudo chmod 755 *.sh

4、输入sudo sh ./startup.sh,回车

cxhdeMacBook-Air:bin cxh$ sudo sh ./startup.sh

回车后显示内容:

Using CATALINA_BASE:   /Users/cxh/Documents/apache-tomcat-7.0.73

Using CATALINA_HOME:   /Users/cxh/Documents/apache-tomcat-7.0.73

Using CATALINA_TMPDIR: /Users/cxh/Documents/apache-tomcat-7.0.73/temp

Using JRE_HOME:        /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Using CLASSPATH:       /Users/cxh/Documents/apache-tomcat-7.0.73/bin/bootstrap.jar:/Users/cxh/Documents/apache-tomcat-7.0.73/bin/tomcat-juli.jar

Tomcat started.

cxhdeMacBook-Air:bin cxh$ 


说明:

  • sudo为系统超级管理员权限.
  • chmod 改变一个或多个文件的存取模式
  • 755代表用户对该文件拥有读、写、执行的权限,同组的其他人员拥有执行和读的权限,没有写的权限,其它用户的权限和同组人员一样.
  • 777代表,user,group ,others ,都有读写和可执行权限.
  • chmod -R 777 folername,获取文件夹权限.


整体终端界面如下:

Last login: Mon Dec  5 11:05:02 on ttys000

cxhdeMacBook-Air:~ caoxiaohong$ cd /Users/cxh/Documents/apache-tomcat-7.0.73/bin

cxhdeMacBook-Air:bincxh$ pwd

/Users/cxh/Documents/apache-tomcat-7.0.73/bin

cxhdeMacBook-Air:bincxh$ sudo chmod 755 *.sh

cxhdeMacBook-Air:bincxh$ sudo sh ./startup.sh

Using CATALINA_BASE:   /Users/cxh/Documents/apache-tomcat-7.0.73

Using CATALINA_HOME:   /Users/cxh/Documents/apache-tomcat-7.0.73

Using CATALINA_TMPDIR: /Users/cxh/Documents/apache-tomcat-7.0.73/temp

Using JRE_HOME:        /Library/Java/JavaVirtualMachines/1.6.0.jdk/Contents/Home

Using CLASSPATH:       /Users/cxh/Documents/apache-tomcat-7.0.73/bin/bootstrap.jar:/Users/cxh/Documents/apache-tomcat-7.0.73/bin/tomcat-juli.jar

Tomcat started.

cxhdeMacBook-Air:bincxh


说明:

当第一个打开成功后,以后再打开就可以操作2步即可启动tomcat。

1、打开startup.sh目录。终端输入:cd /Users/cxh/Documents/apache-tomcat-7.0.73/bin

cxhdeMacBook-Air:~ cxh$ cd /Users/cxh/Documents/apache-tomcat-7.0.73/bin


2、执行startup.sh批处理文件。终端输入:sudo ./startup.sh

cxhdeMacBook-Air:bin cxh$ sudo ./startup.sh



 

  • 5
    点赞
  • 15
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值