Tomcat configuration and custom JRE environment on MAC

Time:2021-7-31

download

  1. Configuring the Java environment
    First, go to the Oracle official website to download JDK and configure environment variables, which will not be repeated here.

  2. Download Tomcat
    Take tomcat9 as an example
    Tomcat download address

Tomcat configuration and custom JRE environment on MAC

start-up

After downloading, use the command to unzip it to the directory where you stored it first
tar -zxvf apache-tomcat-9.0.41.tar.gz -C ~/Local

Enter the Tomcat directory and start with the command

cd apache-tomcat-9.0.41/bin

startup.sh

You can configure environment variables

vim ~/.bash_profile

Add the following to the configuration file

export CATALINA_HOME=~/Local/apache-tomcat-9.0.41
export PATH=$PATH:$CATALINA_HOME/bin

Configuring the JRE environment for Tomcat

If you do not want to use the local JRE environment when deploying the project, configure JRE in the Tomcat directory,
DirectlyjrePut onapache-tomcat-9.0.41Directory, and then modify the directory under the bin directory of Tomcatcatalina.shFile. Add to fileJRE_HOME=../jreOne line is enough

Tomcat configuration and custom JRE environment on MAC

Run project

Put the packaged items directly intoapache-tomcat-9.0.41/webappsDirectory

If you start with. / startup.sh, the console is not displayed.

To display log information like windows:. / catalina.sh run

Or if you want to view the log, view it directlycatalina.outOutput log for

tail -f ../logs/catalina.out

This work adoptsCC agreement, reprint must indicate the author and the link to this article