Fixing and Continuing in a Debugging Session
See Also
If you find a problem while debugging, you can use the Apply Code Changes
command to fix your source and then continue debugging with the changed code without restarting your program.
It is not possible to use the Apply Code Changes command to do the following:
- Change a modifier of a field, a method, or a class
- Add or remove methods or fields
- Change the hierarchy of classes
- Change classes that have not been loaded into the virtual machine
To fix your code:
- From the main menu, choose Debug > Apply Code Changes
to recompile and begin repairing your source code.
- If there are errors during compilation, nothing is changed in your program.
Edit your source code as needed, then execute the Apply Code Changes command
again.
- If there are no errors, the resulting object code is swapped into the currently
executing program. However, all calls on the call stack continue running
the unfixed code. To use the modified code, you must pop from the call
stack any calls that contain modified code. When the calls are reentered,
they use the modified code.
Note: If you modify the currently running method, the IDE displays
an alert box. If you click the Pop Call button, the most recent call is
removed from the current call stack. If you click the Leave Call button,
the program executes with the original version of the code. If there is only
one call in the stack, you cannot pop the call and continue.
- Continue the program to verify that the fixed version of your code works correctly.
- The Apply Code Changes command does not automatically rebuild
JAR files, executable files, or similar files. You must rebuild these files
if you want to debug them in a new session.
- See Also
- Stepping Through Your Program
- Using the Call Stack
Legal Notices