35 | | |
| 35 | === Java Debugging === |
| 36 | {{{ |
| 37 | Step 2: Request a Thread Dump from the JVM |
| 38 | jstack |
| 39 | |
| 40 | If installed/available, we recommend using the jstack tool. It prints thread dumps to the command line console. |
| 41 | |
| 42 | To obtain a thread dump using jstack, run the following command: |
| 43 | jstack <pid> |
| 44 | |
| 45 | You can output consecutive thread dumps to a file by using the console output redirect/append directive: |
| 46 | jstack <pid> >> threaddumps.log |
| 47 | }}} |
| 48 | |
| 49 | Remote Debugging: Client Side: http://help.eclipse.org/indigo/index.jsp?topic=%2Forg.eclipse.jdt.doc.user%2Ftasks%2Ftask-remotejava_launch_config.htm |
| 50 | |
| 51 | http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html |
| 52 | {{{ |
| 53 | In order to remote debug a Java application from Eclipse, that application must be started with following JVM debug options: |
| 54 | |
| 55 | java -Xdebug -Xrunjdwp:transport=dt_socket,address=8001,server=y,suspend=n -jar stockTradingGUI.jar |
| 56 | |
| 57 | This will start java application stockTradingGUI into debug mode using Java Debug Wire Protocol (jdwp) protocol and it will listen on port 8001 suspend=y will ensure that that application will not start running until Eclipse connect it on speicified debug port.It also important to note that application must be start before Eclipse tries to connect it other wise Eclipse will throw error "Failed to connect to remote VM. Connection refused" or "Connection refused: connect" |
| 58 | |
| 59 | Read more: http://javarevisited.blogspot.com/2011/02/how-to-setup-remote-debugging-in.html#ixzz2neS6aaZg |
| 60 | |
| 61 | |
| 62 | {{{ |