In this article we will learn how to configure to run Tomcat in debug made with IntelliJ.
1) Download the tomcat for MacOS. You need to download tar.gz file for MacOS. I have used Tomcat 8 for debug setup.
2) Press Command + Space and type “terminal” in the search bar.
3) Go to the tomcat directory from the terminal and extract the folder contents by typing below command:
tar -xvf apache-tomcat-8.tar.gz
4) It will extract the folder contents in the same location.
5) Go to the bin folder and type below command:
./catalina.sh jpda run
jpda is the switch to run the Tomcat in debug mode. By default Tomcat run on 8000 port for debug mode. If you need to change the port number, you need to make changes in the bin/Catalina.sh file by setting
8180 will be the port to run the Tomcat on debug mode. It can be any value.
6) Now go to IntelliJ IDE.
7) Navigate to Run > Edit Configurations Option
8) A New Dialog box will appear:
9) Click on + sign on the window for adding new configuration and select Remote option from the dialog box.
10) Provide the name of the configuration and in the port box provide the port number which has been configured.
11) From the toolbar select the remote configuration name and click on the icon with bug picture.
The Tomcat is configured now for debug mode. Just put breakpoint at the code line and you will be able to run and debug the code.