3

I was doing a remote debug for a sql exception. The jar was present in the remote location. I was doing a remote debug from eclipse. Suddenly, I realised that it was throwing exception for connection.close() without a connection.commit().

So, I dropped the frame in the debug and added the connection.commit(). This worked. The connection was closed.

My question is how is this even possible? The class file was present in the jar and the code change was done locally on my eclipse..!!!

Volker Stolz
  • 7,274
  • 1
  • 32
  • 50
  • 3
    http://stackoverflow.com/questions/3591497/java-remote-debugging-how-does-it-work-technically Might help – seenukarthi Mar 23 '15 at 07:40
  • My eclipse had the build automatically enabled. – Srivats Bharadwaj Mar 23 '15 at 08:59
  • how is that possible? You must not be running an enterprise application setup with application server. You can't hot swap .class files, you would need to restart the server. However if it was a JSP then you could hot swap – scarecrow- Nov 30 '16 at 20:15

1 Answers1

3

Using a debugger in Java is a bidirectional thing. The debugger can send e.g. breakpoints to the running program and the running program can send back e.g. variable contents to the debugger.

When replacing code this code can also be sent to the program running (hot code replacement).

When you restart the debugged program then the changes made by the debugger are lost again.

Uwe Plonus
  • 9,803
  • 4
  • 41
  • 48