The principle of Java remote debugging is to communicate between two VMS through the debug protocol, and then to achieve the purpose of remote debugging. Between the two can be communicated through the socket.
The first time the virtual machine of the debug program to start the debug mode, start the Debug listener program.
Java-xdebug-xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n zhc_application
Zhc_application is the main program, and Server=y indicates a request to listen to the other debugclient side. address=8000 indicates that the port is 8000
Suspend indicates whether the VM is started after the debugging client establishes a connection. If y, then the current VM is suspend until the debug client connection comes in to start executing the program. If your program is not a server listening mode and executes quickly, then you can choose to block its startup by Y.
then use a The debug client goes to debug remote programs, such as the debug client with Eclipse, fill in the port number and address of the virtual machine running the Debug program, select Connect as attach.
Okay, you can start remote debugging now.
Eclipse Debug Shortcut keys:
F5 Step into
F6 Step Over
F7 Step out
F8 continue to the next breakpoint
Intellij Debug Shortcut keys
F7,step into
F8,step over
Shift+f8, Step out
ALT+F9, run to Cursor
F9, recovery program
Original: http://blog.csdn.net/hongchangfirst/article/details/44191925
Author: Hongchangfirst
Hongchangfirst's homepage: http://blog.csdn.net/hongchangfirst
The principle and application of Java remote debugging