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.
When you start a program, the following parameter options are added to the custom command line, and the program starts in a REMOTEDEUBG-supported manner.
Wrapper.java.additional.1=-xdebug
Wrapper.java.additional.2=-xrunjdwp:transport=dt_socket,server=y,address=7899,suspend=n
The debug option parameter means:
-xdebug enable debugging;
-XRUNJDWP loading jdwp JPDA reference execution instance;
Transport is used to communicate between the debugger and the processes used by the VM;
Dt_socket socket transmission;
Whether the server=y/n VM needs to be executed as a debug server;
address=7899 the port number on which the debugging server listens;
suspend=y/n whether to start the VM after the debugging client establishes a connection.
Once the program is ready, configure Eclipse and let it access the remote VM. The process is fairly simple.
First break the breakpoint in the program, and then
Run-->debug configurations...-->remote Java application--> right key new--> fill in host and port (for example, host:10.75.0.103,port:7899)-->debug
Eclipse Debug Shortcut key:
F5 Step Into
F6 Step Over
F7 Step Out
F8 continue to the next breakpoint