The Servlet 4.0 specification is out and Tomcat 9.0.x does support it. Time to dive into Tomcat 9. [updated on Sep.2.2018]

Prerequisite: Java

Since OS X 10.7 Java is not (pre-)installed anymore, let’s fix that first. As I’m writing this, Java 1.8.0_181 is the latest version for Java 8, available for download here: http://www.oracle.com/technetwork/java/index.html

The JDK installer package comes in a dmg and installs easily on the Mac; and after opening the Terminal app again,

 
1
java -version

now shows something like this:

 
1
2
3
java version "1.8.0_181"
Java(TM) SE Runtime Environment (build 1.8.0_181-b13)
Java HotSpot(TM) 64-Bit Server VM (build 25.181-b13, mixed mode)

Whatever you do, when opening Terminal and running ‘java -version’, you should see something like this, with a version of at least 1.8.x I.e. Tomcat 9.x requires Java 8 or later.

sudo
sudo is a program for Unix-like operating systems, allowing you to run programs with the security privileges of another user (normally the superuser, or root). Since we are creating directories, outside of your home folder, administrator right are required. I.e., when executing sudo you will be asked to enter your password; and your Mac User account needs to be an ‘Admin’ account.

JAVA_HOME is an important environment variable, not just for Tomcat, and it’s important to get it right. Here is a trick that allows me to keep the environment variable current, even after a Java Update was installed. In ~/.bash_profile, I set the variable like so:

 
1
export JAVA_HOME=$(/usr/libexec/java_home)

Installing Tomcat

Here are the easy to follow steps to get it up and running on your Mac

  1. Download a binary distribution of the core module: apache-tomcat-9.0.12 from here. I picked the tar.gz in Binary Distributions / Coresection.
  2. Opening/unarchiving the archive will create a new folder structure in your Downloads folder: (btw, this free Unarchiver app is perfect for all kinds of compressed files and superior to the built-in Archive Utility.app)
    ~/Downloads/apache-tomcat-9.0.12
  3. Open to Terminal app to move the unarchived distribution to /usr/local
    sudo mkdir -p /usr/local
    sudo mv ~/Downloads/apache-tomcat-9.0.12 /usr/local
  4. To make it easy to replace this release with future releases, we are going to create a symbolic link that we are going to use when referring to Tomcat (after removing the old link, you might have from installing a previous version):
    sudo rm -f /Library/Tomcat
    sudo ln -s /usr/local/apache-tomcat-9.0.12 /Library/Tomcat
  5. Change ownership of the /Library/Tomcat folder hierarchy:
    sudo chown -R <your_username> /Library/Tomcat
  6. Make all scripts  executable:
    sudo chmod +x /Library/Tomcat/bin/*.sh

Tomcat 9.x

Instead of using the start and stop scripts, like so:
$ /Library/Tomcat/bin/startup.sh
$ /Library/Tomcat/bin/shutdown.sh

you may also want to check out Activata’s Tomcat Controller, or here  a tiny freeware app, providing a UI to quickly start/stop Tomcat. It may not say so, but Tomcat Controller works on macOS 10.14 just fine.

Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page: http://localhost:8080

 

macOS 下安装tomcat的更多相关文章

  1. Linux下安装Tomcat服务器和部署Web应用

    一.上传Tomcat服务器

  2. Mac下安装Tomcat及配置

    今天介绍Mac下Tomcat的安装及配置: 1.在搜索引擎(如:必应或百度)中搜索“Tomcat”,第一条搜索结果就是Tomcat官方地址: 2.在左侧选择“Tomcat8”或“Tomcat9”,我这 ...

  3. 转】Linux下安装Tomcat服务器和部署Web应用

    原博文出自于: http://www.cnblogs.com/xdp-gacl/p/4097608.html 感谢! 一.上传Tomcat服务器

  4. linux下安装tomcat和部署web应用

      孤傲苍狼 只为成功找方法,不为失败找借口! Linux下安装Tomcat服务器和部署Web应用 一.上传Tomcat服务器

  5. CentOS下安装Tomcat 8

    CentOS下安装Tomcat 8 安装Tomcat8 去http://tomcat.apache.org/download-80.cgi下载Tomcat8的安装文件apache-tomcat-8.0 ...

  6. 分布式进阶(四)Ubuntu 14.04下安装Tomcat 6

    Ubuntu 10.04下安装Tomcat 6 1,下载apache-tomcat6, 地址链接:http://archive.apache.org/dist/tomcat/tomcat-6/v6.0 ...

  7. Linux 下安装 tomcat

    前提:已经安装配置好了 JDK 1.下载二进制文件 wget http://us.mirrors.quenda.co/apache/tomcat/tomcat-9/v9.0.19/bin/apache ...

  8. Ubuntu下安装tomcat

    下面记录了Ubuntu 16.04下安装Tomcat 8.5.9的过程步骤. 1.到官网下载tomcat8.5.9,选择格式为tar.gz.2.通过ftp将下载的tomcat8.5.9压缩包上传到ub ...

  9. 如何在Windows下安装Tomcat服务器

    Tomcat 服务器是一个免费的开放源代码的Web 应用服务器,属于轻量级应用服务器,在中小型系统和并发访问用户不是很多的场合下被普遍使用,是开发和调试JSP 程序的首选服务器.在Windows下安装 ...

随机推荐

  1. npm安装Vue.js

    我之前是有安装过npm的 使用淘宝 NPM 镜像 $ npm install -g cnpm --registry=https://registry.npm.taobao.org 查看nmp版本 $ ...

  2. echarts gl 3d地图,click事件失效,解决办法

    问题 比如点击四川,进行下钻,需要获取点击区域的name属性,根据name进而异步获取四川的地图的json,如下图所示: echart和gl版本 Loaded claygl, version 1.2. ...

  3. Android中自定义xml文件给Spinner下拉框赋值并获取下拉选中的值

    场景 实现效果如下 注: 博客: https://blog.csdn.net/badao_liumang_qizhi 关注公众号 霸道的程序猿 获取编程相关电子书.教程推送与免费下载. 实现 将布局改 ...

  4. PMP-番外篇-PMP工具与技术目录

    ########################################################### 这里先总结所有工具和技术,让大家有一个整体的概念. 也可以当作一个工具和技术查询 ...

  5. OpenCL中读取image时的坐标

    本文测试OpenCL中读取image数据时关于坐标的两个问题: 使用float2坐标读取 使用int2坐标读取 首先完整的测试代码如下,测试平台为SDM855: #include <CL/cl. ...

  6. (办公)记事本_grep文本搜索命令

    参考谷粒学院的linux视频教程:http://www.gulixueyuan.com/course/300/task/7091/show grep文本搜索命令:[是一种强大的文本搜索工具,它能使用正 ...

  7. DC-8靶机渗透实战

    前言: 本文将讲述通过信息收集,再web站点的sql注入漏洞加john爆破登录后台,然后找到远程代码执行漏洞getshell,最后用exim4命令提权漏洞进行权限提升拿到最终的flag. 0x00 环 ...

  8. List和DataTable互转

    /// <summary> /// List和DataTable互转 /// </summary> static class ListUtility { /// <sum ...

  9. 超级丑数--用查找的api解决

    质数又称素数.一个大于1的自然数,除了1和它自身外,不能被其他自然数整除的数叫做质数:否则称为合数. 质因数(素因数或质因子)在数论里是指能整除给定正整数的质数.除了1以外,两个没有其他共同质因子的正 ...

  10. 如何通过 SSH/Telnet 用 root 权限登录群晖

    出于系统安全原因,对 Synology NAS 的 root 访问有限.如果您获取 root 权限,请在命令行界面中用任何属于Local Administrators群组的帐户证书登录 DSM(如Pu ...