Problem: When debugging Java source code, you can only see the source code, but cannot see the immediate value of the variable in the source code
Cause: In order to save space, the JRE removes debug information from the class file when it is packaged.
Idea: Recompile with the src.zip source in the JDK to generate the complete class file with debug information
Practice:
1. Create a new Java Project
2. Unzip the Src.zip, copy and paste the Java and javax two folders inside the project as source
3. In eclipse, open window/preferences/java/compiler/errors or warnings/deprecated and restricted Api/forbidden Reference changed to warning, eliminating the build errors that are actually generated by dependencies on sun and other packages.
4, the use of WinRAR open Jre/lib/rt.jar, the project compiled by the class directory of Java and javax two files pasted into the Rt.jar overlay.
5, use the project you want to debug rely on the source of the project
What if the value of the variable cannot be traced while debugging Java source code?