Step through JDK source code in IntelliJ IDEA

How can I go through the JDK source code in IntelliJ IDEA 7 and see debugging information? Currently I can hit breakpoints and execute code, but debugging information is not available. This means that I do not see the value of local variables.

I only want to go through the source code of one class, if that matters. (For what it's worth the javax.swing.text.html.HTMLDocument class (and I have a copy of the corresponding .java file).)

+44
java debugging intellij-idea
Aug 21 '09 at 19:50
source share
6 answers

If you look at the menu [Menu File β†’] Settings β†’ Debugger β†’ Step, you will see the list β€œDo not enter these classes”, possibly with β€œjava. *” Specified there. This is true? You can disable this.

Debug information is not available. According to this thread :

Unfortunately, JDK classes have debugging information for parameters and a local variable.

A few years ago, I submitted a request that Idea should output the necessary information from the source code (basically converting variable names into indices into local var methods):
Debugger: Show variable information when there is no debugging information

Please vote / comment.

As a workaround, you can recompile the JDK from the source, but you need to exclude some classes that do not have all the necessary source code.

Interestingly, you can download the beta version.

+29
Aug 21 '09 at 19:52
source share

UPDATE : IntelliJ IDEA 13+ version can provide information about local variables without debugging information .

The Java classes that are part of the JDK are compiled without debugging information for size and performance reasons. If you need debugging information in these classes, you will also need to install a development JDK in which classes are created with debugging information or rebuild the parts of the JDK that you want to debug from the source, with debugging information and setting up a new JDK with these versions of classes in banks.

This thread contains instructions for restoring JDK classes in rt.jar from source code with debugging information.

PS This question does not apply to IntelliJ IDEA.

+27
Aug 21 '09 at 20:01
source share
  • Install JDK
  • Add path src.jar
    • Go to: Project Structure (Project Settings)> Platform Settings> SDK> Source Path
    • Add 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 the program (x86) for the 32-bit version)
    • Wait a long time for indexing!
  • Remove debug filter
    • Go to: Settings> Debugger> Step
    • Uncheck the box you want, for example. javax. *
+12
Apr 24 '13 at 2:22
source share

Along with the "Do not enter these classes" information, you must configure src.jar. Right-click the project, select "Open module settings." In the "Platform Settings" section, select "SDK". Select the version of Java SDK that you are using. Select the tab "Source path", click the "+" button and add your src.jar from the JDK (or a separate download of the source code for the OSX JDK). This will allow you to open the JDK classes and insert them during debugging.

+3
Aug 29 2018-12-12T00:
source share

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

  • File> Project Structure

  • Selected "SDKs" in the "Platform Settings" section.

  • Selected "Android SDK"

  • Selected Source Path Tab

  • Click "+"

  • View the location of my Java source code

+1
Sep 27 '12 at 9:52
source share

settings - compiler - java Compiler - java parameters, you should check the option "generate debug information", then it will compile with debug information.

0
Oct 29 '09 at 9:49
source share



All Articles