如何在mac上安装java服务器

1 安装 Homebrew
$ ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
$ echo 'export PATH="/usr/local/bin:$PATH"' >> ~/.bash_profile
$ brew doctor

2 安装java
$ brew cask install java7

3 安装tomcat
$ brew install tomcat

4 配置环境
$vim .bash_profile

TOMCAT_HOME=/usr/local/Cellar/tomcat/8.5.5/libexec/bin
JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk1.7.0_80.jdk/Contents/Home
PATH=$TOMCAT_HOME/bin:$PATH
PAHT=$JAVA_HOME/bin:$PAHT

export TOMCAT_HOME
export JAVA_HOME
export PATH

$ source .bash_profile (立即生效)

5 运行
/usr/local/Cellar/tomcat/8.5.5/libexec/bin/startup.sh

你可能感兴趣的:(如何在mac上安装java服务器)