If you are developing in java with eclipse then add this to the start up script of any apps you are developing -Xrunjdwp:transport=dt_socket,suspend=n,server=y,address=8993
You can then connect to them remotely using the Remote Java Application debug configuration in eclipse. You can then use the eclipse debugger to step through any tricky code.
The application will start with “Listening for transport dt_socket at address: 8993” and you connect to it through this port. Inside eclipse you can add any jars, local projects etc. to the debugger as it steps into new classes and you can then view the code (and the application) as it runs.