I added a Java project to Eclipse and I am running it from the command line. Since it was pre-built, I did not build it. The project, OfBiz, is enabled for remote debugging. Do I need to compile the project in Eclipse before I can remote debug into it?
+3
A:
No you don't need to recompile, but you have to start your application with options like:
-Xdebug -Xrunjdwp:transport= dt_socket,address=1044,server=y,suspend=n
The port here 1044 of course can be changed. If you application is running, open the debug dialog and attach the eclipse debugger to the application's JVM using "Remote Java Application" / New
EDIT: I forgot to mention that this requires that the precompiled app is start externaly. If you wan't to start it from inside eclipse, you would have to recompile otherwise eclipse can not find the 'Main' class to execute.
stacker
2010-01-20 20:47:42
If the code has been compile with optimization 'on' and line numbers 'off', stepping through the code might look strange, if you attach the source. Eclipse counts the lines including comments etc, whereas the debugger reports the line numbers as they are after the optimization.
phisch
2010-01-20 21:11:32
Good objection, if so then he would have to recompile. I wonder why this didn't happen if I step in runtime libraries, are they not optimized?
stacker
2010-01-20 21:49:16
Debugging information is separate from line numbers. Those libs are optimized but have line numbers left in for just this purpose.
Kelly French
2010-01-26 15:09:40