Skip to main content



      Home
Home » Language IDEs » Java Development Tools (JDT) » JDT Debug - How to watch non-public variables ?
JDT Debug - How to watch non-public variables ? [message #1785057] Sun, 08 April 2018 16:50 Go to next message
Eclipse UserFriend
I am not new to programming but I am just learning the Java language and Eclipse. I want to see how Java works internally for some of the various "standard" imported classes using Eclipse's debug facilities (JDT Debug). My setup (Oxygen w/ JDK SE8 on Windows 8.1) works fine as far as single stepping through the code but many of the imported Class variables are unable to be placed into a watchlist or expression monitor, which I think is because they are not defined as "public".

As an example: I want to learn how java.math.BigInteger works so I wrote a quick program which uses the pow() method. The program runs successfully, and when using debug mode I am able to track the flow fine as well. What I cannot seem to do is to see the values of the internal "default" (no access modifier) variables. Below are three such variables found in BigInteger.java (lines 2225-2231):
    int powersOfTwo = partToSquare.getLowestSetBit();
    long bitsToShift = (long)powersOfTwo * exponent;
    if (bitsToShift > Integer.MAX_VALUE) {
        reportOverflow();
    }
    
    int remainingBits;

Any suggestions on how to expose these variables to JDT Debug for learning purposes?

[Updated on: Sun, 08 April 2018 22:34] by Moderator

Re: JDT Debug - How to watch non-public variables ? [message #1785078 is a reply to message #1785057] Mon, 09 April 2018 04:41 Go to previous message
Eclipse UserFriend
For a normal user program, you can see these values by default. For JRE classes it depends, you can not see them for Java 8 but for Java 9 you can see the values.

Normally if all the debugging properties are available, the values should be available without any extra work.
Previous Topic:eclipse.jdt.core compilation on Ubuntu command line
Next Topic:Error can't find main class
Goto Forum:
  


Current Time: Thu Jul 24 18:24:05 EDT 2025

Powered by FUDForum. Page generated in 0.02788 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top