[ACCEPTED]-Step through JDK source code in IntelliJ IDEA-java

Accepted answer
Score: 42

If you look in [File menu ->] Settings 16 -> Debugger -> Stepping you will see 15 a list "Do not step into these classes", probably 14 with "java.*" listed there. Is 13 that the case? You can turn that off there.

Apparently 12 the debug information is not available. According 11 to this thread:

Sadly the JDK classes have debug information 10 for parameters and local variable stripped 9 off.

Years ago I filed a request that Idea 8 should deduce the necessary information 7 from the source code (basically converting 6 variable names to indexes into the methods 5 local var):
Debugger: Show variable information when no debug info

Please vote/comment.

As a workaround 4 you can re-compile the JDK from sources, but 3 you need to exclude some classes which do 2 not have all needed source code attached.

Interestingly, you 1 can download the beta version of Java 6u18, which has debug information in it (in the DEBUG bundle).

Score: 27

UPDATE: IntelliJ IDEA 13+ version can provide local variables information without debug info.

Java classes 13 which are part of the JDK are compiled without 12 debug info for the size and performance 11 reasons. If you want debug info in these 10 classes, you'll either need to install a 9 development version of the JDK where the 8 classes are built with the debug info or 7 rebuild the parts of JDK you want to debug 6 from source with the debug info enabled 5 and configure the new JDK with these versions 4 of classes in jars.

This thread provides the instructions 3 how to rebuild JDK classes in rt.jar from 2 the source code with debugging information.

P.S. This 1 question is not specific to IntelliJ IDEA.

Score: 16
  1. Install the JDK
  2. Add src.jar path
    1. Go to: Project Structure (Project Settings) > Platform Settings > SDKs > Sourcepath
    2. Add the path to src.jar
      • OSX example: /Library/Java/JavaVirtualMachines/1.6.0_45-b06-451.jdk/Contents/Home
      • Windows example: C:\Program Files\Java\jdk1.7.0_03 (check Program (x86) for 32-bit)
    3. Wait a long time for indexing!
  3. Remove debugger filter
    1. Go to: Settings > Debugger > Stepping
    2. Uncheck the package(s) you want, e.g. javax.*

0

Score: 3

Along with the "Do not step into these classes" information, the 9 src.jar should be configured. Right-click 8 the project, select "Open Module Settings." Under 7 Platform Settings, select "SDKs." Select 6 the Java SDK version you're using. Select 5 the Sourcepath tab, hit the "+" button, and 4 add your src.jar from the JDK (or the separate 3 source download for the OSX JDK). This will 2 let you open JDK classes and step into them 1 while debugging.

Score: 2

I did this on my Mac to get my Android source 6 code but a similar approach should work 5 for you.

  • File > Project Structure

  • Selected 4 "SDKs" under Platform Settings.

  • Selected 3 "Android SDK"

  • Selected "Sourcepath" tab

  • Pressed 2 "+"

  • Browsed to location of my Java source 1 code

Score: 0

you can find the source code from External 1 Libraries --> rt.jar

More Related questions