<?xml version="1.0"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="zh-Hans-CN">
	<id>https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Debug_JDK_source_code</id>
	<title>Debug JDK source code - 版本历史</title>
	<link rel="self" type="application/atom+xml" href="https://wiki.riguz.com/index.php?action=history&amp;feed=atom&amp;title=Debug_JDK_source_code"/>
	<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;action=history"/>
	<updated>2026-06-02T20:10:04Z</updated>
	<subtitle>本wiki上该页面的版本历史</subtitle>
	<generator>MediaWiki 1.42.3</generator>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=3854&amp;oldid=prev</id>
		<title>2023年12月19日 (二) 11:37 Riguz</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=3854&amp;oldid=prev"/>
		<updated>2023-12-19T11:37:37Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月19日 (二) 11:37的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l30&quot;&gt;第30行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第30行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is debug jdk source can&amp;#039;t watch variable what it is]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is debug jdk source can&amp;#039;t watch variable what it is]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;br&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;−&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #ffe49c; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;del style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;JVM&lt;/del&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;[[Category:&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;JDK&lt;/ins&gt;]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki_db:diff:1.41:old-3853:rev-3854:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=3853&amp;oldid=prev</id>
		<title>2023年12月19日 (二) 11:37 Riguz</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=3853&amp;oldid=prev"/>
		<updated>2023-12-19T11:37:00Z</updated>

		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;col class=&quot;diff-marker&quot; /&gt;
				&lt;col class=&quot;diff-content&quot; /&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;2&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月19日 (二) 11:37的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot; id=&quot;mw-diff-left-l29&quot;&gt;第29行：&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;第29行：&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://stackoverflow.com/questions/1313922/step-through-jdk-source-code-in-intellij-idea Step through JDK source code in IntelliJ IDEA]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://stackoverflow.com/questions/1313922/step-through-jdk-source-code-in-intellij-idea Step through JDK source code in IntelliJ IDEA]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is debug jdk source can&amp;#039;t watch variable what it is]&lt;/div&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot;&gt;&lt;/td&gt;&lt;td style=&quot;background-color: #f8f9fa; color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #eaecf0; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;* [https://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is debug jdk source can&amp;#039;t watch variable what it is]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-side-deleted&quot;&gt;&lt;/td&gt;&lt;td class=&quot;diff-marker&quot; data-marker=&quot;+&quot;&gt;&lt;/td&gt;&lt;td style=&quot;color: #202122; font-size: 88%; border-style: solid; border-width: 1px 1px 1px 4px; border-radius: 0.33em; border-color: #a3d3ff; vertical-align: top; white-space: pre-wrap;&quot;&gt;&lt;div&gt;&lt;ins style=&quot;font-weight: bold; text-decoration: none;&quot;&gt;[[Category:JVM]]&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;

&lt;!-- diff cache key wiki_db:diff:1.41:old-3823:rev-3853:php=table --&gt;
&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=3823&amp;oldid=prev</id>
		<title>Riguz：​Riguz移动页面Blog:调试JDK源码至Debug JDK source code，不留重定向</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=3823&amp;oldid=prev"/>
		<updated>2023-12-19T09:03:45Z</updated>

		<summary type="html">&lt;p&gt;Riguz移动页面&lt;a href=&quot;/index.php?title=Blog:%E8%B0%83%E8%AF%95JDK%E6%BA%90%E7%A0%81&amp;amp;action=edit&amp;amp;redlink=1&quot; class=&quot;new&quot; title=&quot;Blog:调试JDK源码（页面不存在）&quot;&gt;Blog:调试JDK源码&lt;/a&gt;至&lt;a href=&quot;/Debug_JDK_source_code&quot; title=&quot;Debug JDK source code&quot;&gt;Debug JDK source code&lt;/a&gt;，不留重定向&lt;/p&gt;
&lt;table style=&quot;background-color: #fff; color: #202122;&quot; data-mw=&quot;interface&quot;&gt;
				&lt;tr class=&quot;diff-title&quot; lang=&quot;zh-Hans-CN&quot;&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;←上一版本&lt;/td&gt;
				&lt;td colspan=&quot;1&quot; style=&quot;background-color: #fff; color: #202122; text-align: center;&quot;&gt;2023年12月19日 (二) 09:03的版本&lt;/td&gt;
				&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-notice&quot; lang=&quot;zh-Hans-CN&quot;&gt;&lt;div class=&quot;mw-diff-empty&quot;&gt;（没有差异）&lt;/div&gt;
&lt;/td&gt;&lt;/tr&gt;&lt;/table&gt;</summary>
		<author><name>Riguz</name></author>
	</entry>
	<entry>
		<id>https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=2575&amp;oldid=prev</id>
		<title>imported&gt;Riguz：​最近想要直接调试下JDK的源码却发现有些变量不能显示，像这样：

![IntelliJ](/images/Intellij-no-debuginfo.png)</title>
		<link rel="alternate" type="text/html" href="https://wiki.riguz.com/index.php?title=Debug_JDK_source_code&amp;diff=2575&amp;oldid=prev"/>
		<updated>2020-01-25T00:00:00Z</updated>

		<summary type="html">&lt;p&gt;最近想要直接调试下JDK的源码却发现有些变量不能显示，像这样：  ![IntelliJ](/images/Intellij-no-debuginfo.png)&lt;/p&gt;
&lt;p&gt;&lt;b&gt;新页面&lt;/b&gt;&lt;/p&gt;&lt;div&gt;最近想要直接调试下JDK的源码却发现有些变量不能显示，像这样：&lt;br /&gt;
&lt;br /&gt;
[[File:Intellij-no-debuginfo.png|600px|IntelliJ]]&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
其原因是因为JDK中的rt.jar在release的时候没有附带调试信息。所以解决这个问题的思路是这样的：&lt;br /&gt;
&lt;br /&gt;
* 重新编译你想要调试的类(`javac -g`)&lt;br /&gt;
* 将带调试信息的类覆盖原来的&lt;br /&gt;
* 重新进行调试&lt;br /&gt;
&lt;br /&gt;
实际上，在IntelliJ中操作起来可能比较简单，可以分为以下几步：&lt;br /&gt;
&lt;br /&gt;
* 将jdk的源码从JDK中拷贝出来，例如/Library/Java/JavaVirtualMachines/jdk1.8.0_231.jdk/Contents/Home/src.zip&lt;br /&gt;
* 将源码解压，并将其中`java`,`javax`两个文件夹拷贝到一个空的Java工程中&lt;br /&gt;
* 编译源码，IntelliJ默认设置编译是包含了调试信息的。编译完成之后，将其[https://www.jetbrains.com/help/idea/packaging-a-module-into-a-jar-file.html# 导出到jar包]中。&lt;br /&gt;
* 将导出的jar包（比如说rt_debug.jar)放入到`$JAVA_HOME/jre/lib/endorsed`文件夹下面即可。如果这个目录不存在，手动创建一下。&lt;br /&gt;
* 重新进行调试即可。&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:Intellij-with-debuginfo.png|600px|IntelliJ]]&lt;br /&gt;
&lt;br /&gt;
事实上，这里利用了`endorsed-standards override mechanism`这一个JVM特性来重载了Java的类，这个特性已经在Java8中被deprecated了([https://www.java.com/en/download/faq/release_changes.xml release notes for Java 8 Update 40 (8u40) ])，但是Java8中仍然可用。&lt;br /&gt;
&lt;br /&gt;
&amp;gt; The endorsed-standards override mechanism and the extension mechanism are deprecated and may be removed in a future release. There are no runtime changes. Existing applications using the &amp;#039;endorsed-standards override&amp;#039; or &amp;#039;extension&amp;#039; mechanisms are recommended to migrate away from using these mechanisms.&lt;br /&gt;
&lt;br /&gt;
Reference:&lt;br /&gt;
&lt;br /&gt;
* [https://stackoverflow.com/questions/1313922/step-through-jdk-source-code-in-intellij-idea Step through JDK source code in IntelliJ IDEA]&lt;br /&gt;
* [https://stackoverflow.com/questions/18255474/debug-jdk-source-cant-watch-variable-what-it-is debug jdk source can&amp;#039;t watch variable what it is]&lt;/div&gt;</summary>
		<author><name>imported&gt;Riguz</name></author>
	</entry>
</feed>