Remote debugging is a useful tool for web developers, both in the frontend and backend. Remote debugging finds flaws and provides assurance that code works properly and making it more fluent and easier to use. This is a quick guide on how to do remote debugging using IntelliJ Idea IDE.
Here’s are the basics about debugging.
IDE Matters
Often the first IDE used to read and write code is Visual Studio Code (VSC) this is due to its simplicity and familiarity of its extensions. In the case of this example, the project was called “Strongbox,” which ran with Maven and Springboot. It required advanced problem solving to debug a service running remotely. This requires the right IDE. Generally, experts recommend IntelliJ Idea over VSC.
VSC can’t debug as well ad IntelliJ Idea because it was built specifically for Java coding. The moral of the story: Use the right tool for the job.
Remote Debugging
The continuation of this article presumes that an audience that has already debugged a java project and is familiar with breakpoints and the notion of debugging. If these concepts are unfamiliar, a quick tutorial is available here.
Remote debugging is very useful to identify issues that can’t be reproduced locally. To do this, the instance must run on another pc. This kind of debugging is different because the application is running on a remote computer. This means a port to which the debugging tool, IntelliJ, can connect, is available.
The app was running with Maven with the ‘mvn spring-boot:run’ command, which effectively runs the app, but doesn’t set a debugging port.
To set a debugging port it is necessary to run the app as ‘mvnDebug spring-boot:run’. All that was left was to enter the debugging configurations on IntelliJ Idea and click on run as a debugger.
Configuring the Remote Port
Click on Run Configurations in the top right corner.
In IntelliJ Idea the process goes like this,
Click on the plus sign and select Remote to add a new configuration for a remote app to be debugged.
Enter a configuration name and the port in which your app is running in debug mode.
The image above shows the Debug Configuration interface in IntelliJ Idea.
Knowing the port in which the app will be running the debug mode is important. In Maven, the command ‘mvnDebug spring-boot:run’ runs on the port 8000. Now write 8000 on the port input and the address where the app is being hosted.
The task is completed. Accept the configuration and run the Maven app on debug mode followed by the IDE.
Intellij Idea is not the only debugger. There are other debugging tools available, and many can do remote debugging. Tools exist to help debug by setting up watchers, evaluate expressions, remote debugging, drop frames, navigate suspended programs, and the list goes on.
Key Takeaways
-
Remote debugging is a useful tool for web developers, both in the frontend and backend. It finds flaws and provides assurance that code works properly and making it more fluent and easier to use.
-
Remote debugging is also very useful to identify issues that can’t be reproduced locally.
-
There are many debugging tools, make sure to have the one that fits the needs of the job.
About Encora
At Encora, we create competitive advantages for client partners through accelerated technology innovation. We would be delighted to take you further along your journey.
Why Encora
- We’re global: With 20+ offices and innovation labs in 12 countries, Encora is globally dispersed. Since we operate in different time zones, there is always someone ready to assist you.
- We’re full-service: Technology innovation encompasses a huge array of topics, skills, and strategies. We offer a full-service concept, each component custom tailored as per your needs, to present a complete solution.
- We’re dedicated: Our ever-growing team of over 4,000 skilled and dedicated programmers, developers, engineers and strategic thinkers is the reason Encora has become an award-winning tech company with an enviable reputation.
- We’re experienced: We partner primarily with fast-growing tech companies who are driving innovation and growth within their industries. Our unique delivery model, agile methodology, and consistent unmatched quality have contributed to our steady growth.