What if the value of the variable cannot be traced while debugging Java source code?

Source: Internet
Author: User

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?

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.