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]html
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.htmljava
The JDK installer package comes in a dmg and installs easily on the Mac; and after opening the Terminal app again,apache
1
|
java -version
|
now shows something like this:tomcat
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.bash
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:oracle
1
|
export JAVA_HOME=$(/usr/libexec/java_home)
|
Here are the easy to follow steps to get it up and running on your Macapp
sudo mkdir -p /usr/local
sudo mv ~/Downloads/apache-tomcat-9.0.12 /usr/local
sudo rm -f /Library/Tomcat
sudo ln -s /usr/local/apache-tomcat-9.0.12 /Library/Tomcat
sudo chown -R <your_username> /Library/Tomcat
sudo chmod +x /Library/Tomcat/bin/*.sh
Instead of using the start and stop scripts, like so:$ /Library/Tomcat/bin/startup.sh
less
$ /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.ide
Finally, after your started Tomcat, open your Mac’s Web browser and take a look at the default page: http://localhost:8080ui