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. R语言入门:向量索引

    这节的内容是建立在之前我们对R语言最基本向量赋值的基础之上的,笔者本人学完R当中向量的索引感觉异常舒适,因为这个比Python的索引爽多了,是什么值开始索引就从哪里开始索引,到哪里结束就在哪里结束,而 ...

  2. 5.Android-电话拨号器详解

    之前学习了3.Android-ADT之helloworld项目结构介绍后,本章便来写个简单的电话拨号器程序. 实现的步骤如下所示: 1.创建项目 2.写layout/activity_main.xml ...

  3. Java之GUI编程

    GUI编程 组建 窗口 弹窗 面板 文本框 列表框 按钮 图片 监听事件 鼠标 键盘事件 破解工具 1.简介 GUI的核心技术:Swing AWT 为什么不流行? 界面不美观. 需要jre环境.(没必 ...

  4. Centos7之firewall配置命令

    firewalld的基本使用 查看状态:systemctl status firewalld 启动:systemctl start firewalld 停止:systemctl stop firewa ...

  5. Spring Boot 配置拦截器方式

    其实spring boot拦截器的配置方式和springMVC差不多,只有一些小的改变需要注意下就ok了.下面主要介绍两种常用的拦截器: 一.基于URL实现的拦截器: public class Log ...

  6. Windows10官方原版系统下载安装制作方法

    Windows10官方原版系统下载安装制作方法 去官网下载系统安装程序 点进去 https://www.microsoft.com/zh-cn/software-download/windows10 ...

  7. MySql优化之mycat

    1. 解压mycat,不要放在有中文目录的地方  下载地址:http://dl.mycat.io/1.6-RELEASE/2 .修改mycat解压目录下的conf文件夹中server.xml文件,配置 ...

  8. Java基础之二、类的知识

    类定义---方法及其处理的数据对象的集合结构 将现实的对象(物体)和概念映射到程序中的对象(变量)中 1:使用new运算符创建的类类型的主体称为实例,创建实例的操作称为实例化, new Account ...

  9. 爬取豆瓣网图书TOP250的信息

    爬取豆瓣网图书TOP250的信息,需要爬取的信息包括:书名.书本的链接.作者.出版社和出版时间.书本的价格.评分和评价,并把爬取到的数据存储到本地文件中. 参考网址:https://book.doub ...

  10. 在线编辑器(WangEditor)

    自己之前写了一篇关于POI 相关的博客, 想了想在公司中一般常用的不就是上传下载,poi,分页,定时等.好像还有个在线编辑器, 于是自己就花了两个多小时把编辑器相关的代码撸了遍,当然了是先百度找了找资 ...