Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why Eclipse doesn't show local variables values when I debug class file from JDK?

Tags:

I want to debug .class files. For example some from the JDK. I downloaded the sources and attached them.

public File[] listFiles(FilenameFilter paramFilenameFilter) {    String[] arrayOfString = list(); // now we here    if (arrayOfString == null) return null;    .... } 

Then I type F6 and move to the next line. After that, I try to watch the value of arrayOfString but I see the following:

Expression view:

Is it normal a situation? Is there a way to debug?

Update 1:

enter image description here


Update 2:

enter image description here

Update 3:

enter image description here

like image 327
gstackoverflow Avatar asked Apr 14 '14 10:04

gstackoverflow


People also ask

How do I show variables in debugging in Eclipse?

Variables/Expression view – Shows the declared variables and their values. Press Ctrl+Shift+d or Ctrl+Shift+i on a selected variable or expression to show its value. You can also add a permanent watch on an expression/variable that will then be shown in the Expressions view when debugging is on.

How do I debug a .class file in Eclipse?

There are two ways to debug a class file. The first way is to set the decompiler preference, and to realign the line number. The second way is to check the debug mode in the decompiler menu bar. When your Eclipse workspace is in debug perspective, the debug mode becomes the default.

How do I change the variable value in Eclipse while debugging?

Changing a Variable's Value To set a variable go to the Variables view and select the variable you want to change. Right click on the variable and select Change Value... Once you have change the value click ok. The variable now has a new value.


1 Answers

The problem is that the source/class files from the JDK are compiled without debug information and therefore eclipse can't inspect these vars. See this answer for more information.

To solve your problem you need to get a different rt.jar or compile it yourself

like image 192
Absurd-Mind Avatar answered Sep 20 '22 11:09

Absurd-Mind