We typically use eclipse for local debugging of Tomcat, but there are special cases where you need to start Tomcat directly locally (execute Startup.bat in the bin directory of Tomcat), and we can debug with a similar remote debugging mode.
First, we need to add the environment variable setting of remote debugging in Bin/catalina.bat, here we set the debug port number to 18080
Set jpda_opts=-agentlib:jdwp=transport=dt_socket,server=y,suspend=y,address=localhost:18080
Then open the Command Line window, go to the local Tomcat bin directory, execute Catalina JPDA start command to launch Tomcat
D:\wulinfeng\tomcat\apache-tomcat-8.5.13\bin>catalina JPDA Start
Finally, go to eclipse. Configure remote debugging: Click the green bug icon or click run-> on the bug select Debug Configurations->remote Java application-> fill in the Debug name, select the project, Host for localhost, port for 18080-> Click on the lower right corner of the debug button, the following slowly debugging it
Windows debugging locally-launched Tomcat