Install Tomcat (Source)
UPDATE: It seems the IntelliJ bundled java is suffient. So skip first two steps and don't mind java -version
and echo $JAVA_HOME
are not working.
-
Check
java -version
. Tomcat 9.x requires Java 8 or later.java version "13.0.2" 2020-01-14
Java(TM) SE Runtime Environment (build 13.0.2+8)
- If you don't have: Download JDK from Here > Download JDK > jdk-13.0.2_osx-x64_bin.dmg (~ 173MB)
-
Make sure
echo $JAVA_HOME
is set./Library/Java/JavaVirtualMachines/jdk1.8.0_162.jdk/Contents/Home
- If it's not set:
- Find Java Home (= the dir that contains Home/bin/) via
/usr/libexec/java_home -verbose
.- Probably:
/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home
- Probably:
- Add
export JAVA_HOME=/Library/Java/JavaVirtualMachines/jdk-13.0.2.jdk/Contents/Home
to terminal profile (~/.zshrc
or~/.bash_profile
)
- Find Java Home (= the dir that contains Home/bin/) via
- If it's not set:
- Download a binary distribution of the core module: apache-tomcat-9.0.13 from here
- I picked Binary Distributions > Core > tar.gz one.
- unarchiving the archive will create a new folder structure in your Downloads folder: ~/Downloads/apache-tomcat-9.0.13
sudo mkdir -p /usr/local
-p
= --parents = no error if existing, make parent directories as needed
sudo mv ~/Downloads/apache-tomcat-9.xx /usr/local
- 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:
sudo rm -f /Library/Tomcat
(First, remove old link, you might have from installing a previous version)sudo ln -s /usr/local/apache-tomcat-9.xx /Library/Tomcat
sudo chown -R <your_username> /Library/Tomcat
sudo chmod +x /Library/Tomcat/bin/*.sh
-
start and stop like so:
/Library/Tomcat/bin/startup.sh
/Library/Tomcat/bin/shutdown.sh
-
After starting Tomcat, check out the default page at http://localhost:8080. It shows a lot of things, including a yellow cat.