Configure installation-free tomcat under Mac

First, make sure the jdk is installed and enter the java -verion command in the terminal

When the jdk is installed, we only need to run the starup.sh file in the compressed package I downloaded 
in the terminal to run the tomcat server normally, and run the shutdown.sh file in the terminal to shut down the tomcat server.

So now the task is how to run the starup.sh file, this is very simple, find the file, drag it to the console, and press Enter.

At this time we will encounter a problem 
Permission denied 

This is that we haven't given this file permission to run, so we have to give this file permission 
to enter sudo chmod 755 (your tomcat path)/bin/*.sh in the terminal and press Enter 

I am here sudo chmod 755 /Users/zhuyanhui/Downloads/apache-tomcat-8.5.16/bin/*.sh 

This line of code is to give permissions to all files with the suffix .sh under the bin folder 
(if you don't know the path, just drag the file into the path and you will come out, and then modify it yourself) 
Here you need to enter the password (admin password)

At this time, the file has permissions. We can drag the startup.sh file to the console and tomcat can run normally.

tomcat started means that it has been successfully opened. At this time, it is time to browse and test it.

If you want to close it, just drag the shutdown.sh file to the console.

This kind of dragging is a little troublesome, and there are simple methods below.

is to write the path to the .bash_profile file and enter it in the console

touch ~/.bash_profile; // Jump the directory to the .bash_profile folder 
open -t ~/.bash_profile //Open the .bash_profile file 
and a new window will pop up and enter 
export PATH=$PATH:/Users/zhuyanhui /Downloads/apache-tomcat-8.5.16/bin

save, then close the window, exit the terminal

Re-open the terminal and enter startup.sh directly, you can see that the tomcat service starts

The same goes for shutting down services

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=324491880&siteId=291194637