Source: http://hi.baidu.com/bjcubbo/item/9da7a339182364f697f88d06;
Remote debuggingCodeRemote debugging of liunx code in myeclipse
Debug breakpoint debugging is not good in compiled class files, and debugging is not good in liunx. The solution is remote debugging. In debug of myeclipse, there is the remote Java application tool, which can be used to set remote debugging.
To modify the Catalina. Sh file, follow these steps:
Modify the/usr/Apache-Tomcat-6.0.26/bin/Catalina. Sh file in the tomcat installation directory. Add the following content to this file: (I add it to the first line of the file)
Catalina_opts = "-xdebug-xrunjdwp: Transport = dt_socket, address = 10000, Server = Y, suspend = N"
(Here address = 10000 indicates the port number for remote debugging.) save the file after modification.
Step 2: Disable the Firewall
Use the following command to disable the firewall in liunx:
/Etc/rc. d/init. d/iptables stop
Step 2: deploy the projectProgram:
Deploy the project program to be debugged under the E: \ Tomcat 6.0 \ webapps directory in windows to the/usr/Apache-Tomcat-6.0.26/webapps directory in Linux. (Ensure that the programs in Linux are the same as those in myeclipse)
Step 2: restart the Tomcat Service
To stop the Tomcat service, run the following command:
#/Usr/Apache-Tomcat-6.0.26/bin/shutdown. Sh
Run the following command to start the Tomcat service:
#/Usr/Apache-Tomcat-6.0.26/bin/startup. Sh
Step 2: Create a remote Java application
Open myeclipse and create a remote Java application. In myeclipse, there is a bug debug icon in the toolbar. Click the lower triangle symbol next to it and select Open debug dialog, open the debug configuration dialog box. There is a remote Java application in the last item. Right-click a new one.
(Images are included in the attachment)
Step 2: configure remote Java application
Enter a name in name, and then select the project in myeclipse In the CONNECT project below (that is, the project deployed in the Linux system, which must correspond to the remote project ). Use the default connection type. Fill in the IP address of the remote machine (that is, the IP address of the Linux system) in the host of Connection Properties. Fill in port 10000 in the second port (port and Catalina. the address value in the sh file is the same. Make sure that the port is not used by other services ). After the configuration is complete, click the debug button to enable the debugging thread. In the debug window of myeclipse, a debugging thread is started, indicating that the configuration is successful.
Step 2: set breakpoints:
Open the file to be debugged in myeclipse, place a breakpoint in the desired place, and access the program on the remote machine. When the program runs at the breakpoint, it stops and you can perform remote debugging.
(Note: you can modify the local program during debugging to achieve the desired effect. However, the modified files do not affect files on the remote machine. Therefore, the modified files must be updated to the remote machine .)