Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    primarykey
    data
    text
    <p>Generally speaking, to be able to watch the variables while stepping through JDK source code, you need the class files to be compiled with debug information i.e. compile using <code>javac -g</code>.</p> <p>So your best bet is to either find an already compiled version with debug information (I couldn't find anything for JDK 7) or you can try compiling the source for yourself.</p> <p>According to <a href="http://www.javalobby.org/java/forums/t19866.html">this post</a> (please note that I haven't tried it) you don't need to compile all sources, only the ones you need. Putting your newly compiled classes in the <code>$jdk/jre/lib/</code><strike>ext/</strike><code>endorsed</code> directory, the new classes would be used instead the ones in the original <code>rt.jar</code>.</p> <p>I believe that should get you started.</p> <p><strong>Update:</strong> Actually I have just tried this process and it is not hard at all. Tested on Windows, JDK 1.7.0_11. All the commands are invoked from command line:</p> <ol> <li>Create your working folder. I chose <code>d:\</code> root folder</li> <li>Inside your working folder create the source folder i.e. <code>jdk7_src</code> and output folder <code>jdk_debug</code></li> <li>From your <code>JDK_HOME</code> folder get the <code>src.zip</code> file and unzip it inside <code>jdk7_src</code></li> <li>Select what you will compile and delete the rest. For all of them you might need additional steps. I have chosen the folders: <ul> <li><code>java</code></li> <li><code>javax</code></li> <li><code>org</code></li> </ul></li> <li>From your <code>JDK_HOME\jre\lib</code> get the file <code>rt.jar</code> and put in the work folder (this is only for convenience to not specify too large file names in the command line).</li> <li>Execute the command: <code>dir /B /S /X jdk7_src\*.java &gt; filelist.txt</code> to create a file named <code>filelist.txt</code> with the list of all java files that will be compiled. This will be given as input to <code>javac</code></li> <li>Execute <code>javac</code> using the command:<br> <code>javac -J-Xms16m -J-Xmx1024m -sourcepath d:\jdk7_src -cp d:\rt.jar -d d:\jdk_debug -g @filelist.txt &gt;&gt; log.txt 2&gt;&amp;1</code> This will compile all the files in the <code>jdk_debug</code> folder and will generate a <code>log.txt</code> file in your working folder. Check the log contents. You should get a bunch of warnings but no error. </li> <li>Go inside the <code>jdk_debug</code> folder and run the command: <code>jar cf0 rt_debug.jar *</code>. This will generate your new runtime library with degug information.</li> <li>Copy that new jar to the folder <code>JDK_HOME\jre\lib\endorsed</code>. If the <code>endorsed</code> folder does not exist, create it.</li> </ol> <p>Debug your program in Eclipse. Note how the variables are named normally (no more arg0, arg1 etc). Happy debugging :)</p> <p><img src="https://i.stack.imgur.com/KNyWO.png" alt="JDK debug"></p>
    singulars
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. VO
      singulars
      1. This table or related slice is empty.
    2. VO
      singulars
      1. This table or related slice is empty.
    3. VO
      singulars
      1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload