Java remote Debugging is the principle of two VM communication between the debug protocol, and then to achieve the purpose of remote debugging. You can communicate between the two by using a socket.
First, the virtual machine of the debug program starts debug mode on startup and starts the debug listener. JDWP is the abbreviation for the Java Debug Wire protocol.
Java-xdebug-xrunjdwp:server=y,transport=dt_socket,address=8000,suspend=n zhc_application
This is the method before the jdk1.7 version, which can be used after 1.7:
Java-agentlib:jdwp=transport=dt_socket,address=8000,server=y,suspend=n zhc_application
Zhc_application is the main program, server=y indicates that it listens to other debugclient-side requests. address=8000 indicates that the port is 8000
Suspend indicates whether to start the VM after the debugging client establishes a connection. If y, then the current VM is suspend until a debug client connection comes in to execute the program. If your program is not a server listening mode and executes quickly, then you can choose to block its startup in Y.
Then use a debug client to debug a remote program, such as using the Debug client with Eclipse, fill in the port number and address of the virtual machine that runs the debug program, and choose Connect mode as attach.
Okay, you can start remote debugging now.
Eclipse Debug Shortcut key:
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