CnSwift - 雨燕

agile development - 敏捷开发

macOS安装jdk+Tomcat

macOS安装jdk+Tomcat

1、安装jdk

http://www.oracle.com/technetwork/java/javase/downloads/jdk8-downloads-2133151.html

下载 http://download.oracle.com/otn-pub/java/jdk/8u91-b14/jdk-8u91-macosx-x64.dmg

执行jdk-8u91-macosx-x64.dmg,安装成功后配置.bash_profile文件

1
2
cd ~
sudo vim .bash_profile

输入如下内容(注意版本号):

1
2
3
4
5
6
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.8.0_91.jdk/Contents/Home
PATH=$JAVA_HOME/bin:$PATH:.
CLASSPATH=$JAVA_HOME/lib/tools.jar:$JAVA_HOME/lob/dt.jar:.
export JAVA_HOME
export PATH
export CLASSPATH

执行.bash_profile文件

1
source .bash_profile

安装Tomcat

http://tomcat.apache.org/download-90.cgi

下载http://mirror.bit.edu.cn/apache/tomcat/tomcat-9/v9.0.0.M8/bin/apache-tomcat-9.0.0.M8.zip

在根目录创建/java/Tomcat目录

1
sudo mkdir -p /java/Tomcat

拷贝apache-tomcat-9.0.0.M8.zip到/java/Tomcat,解压缩apache-tomcat-9.0.0.M8.zip文件

进入目录apache-tomcat-9.0.0.M8,并给目录bin设置权限

1
2
cd apache-tomcat-9.0.0.M8
chmod -R u+x ./bin

启动Tomcat

1
2
cd bin
./startup.sh

浏览器访问

http://localhost:8080

停止Tomcat

1
./shutdown.sh
感谢赞赏.

Welcome to my other publishing channels