In addition to Weibo, there is also WeChat
Please pay attention
WeChat public account
Shulou
2025-02-25 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Internet Technology >
Share
Shulou(Shulou.com)06/02 Report--
This article mainly explains "how to use IDEA to debug code remotely". The content of the article is simple and clear, and it is easy to learn and understand. Please follow the editor's train of thought to study and learn "how to debug code remotely using IDEA".
Often encountered at work to connect to the development database, the program has no problems, but as soon as it is online or running in the test environment, there are all kinds of problems, now let's configure the remote debug.
I. principle
The two VM of the local machine and the remote host communicate through the Socket using the Debug protocol to transmit debugging instructions and debugging information.
Remote virtual machine of the debugged program: as a Debug server, listens for Debug debugging instructions. Jdwp is the abbreviation of Java Debug Wire Protocol.
Local virtual machine for the debugger: the Remote Server configured in IDEA, which specifies the Host:Port of the Debug server for Debug client programs to connect.
Second, remote debugging steps
1. Use spring-boot to create test project ares-boot, and write test Controller
Package com.ares.controller;import org.springframework.web.bind.annotation.RequestMapping;import org.springframework.web.bind.annotation.RestController;@RestController@RequestMapping ("/ hello") public class HelloController {@ RequestMapping ("") public String hello (String name) {return "hello" + name;}}
Pack it into a jar package and start the service using java-jar
Java-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:10090-jar ares-springboot-1.0.0.jar-- server.port=9090 where-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=*:10090 specifies the port for open debugging
2. IDEA configure startup environment (Debug server)
Create a new remote
Configure the service address and port to debug
Using debug to launch and the browser to visit http://localhost:9090/hello, we find that Idea has entered the debug mode
Note:
1) sometimes prompt Connect time out when debugging, and you need to turn off the firewall at this time
2) remote debugging can be carried out only if the local and remote code are consistent.
Thank you for reading, the above is the content of "how to use IDEA to debug code remotely". After the study of this article, I believe you have a deeper understanding of how to use IDEA to debug code remotely, and the specific use needs to be verified in practice. Here is, the editor will push for you more related knowledge points of the article, welcome to follow!
Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.
Views: 0
*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.
Continue with the installation of the previous hadoop.First, install zookooper1. Decompress zookoope
"Every 5-10 years, there's a rare product, a really special, very unusual product that's the most un
© 2024 shulou.com SLNews company. All rights reserved.