在哪里可以找到 java.lang 本机方法的源代码?

发布于 2024-08-22 21:28:50 字数 1539 浏览 1 评论 0原文

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

怪我入戏太深 2024-08-29 21:28:50

对于 JDK6,您可以从 java.net 下载源代码。对于java.lang,故事从j2se/src/share/native/java/lang/开始,然后搜索...JDK7稍微重新排列了目录结构。

有些方法,例如Object.hashCode,可以通过热点来实现,而不是通过JNI/Java 实现,或者另外通过JNI/Java 来实现。

JDK6 通过 Java 研究许可证 (JRL) 和 Java 内部使用许可证 (JIUL) 免费获得许可。 JDK7 和 OpenJDK6 在 GPL 2 下获得许可,但有 CLASSPATH 例外(粗略地说,您可以链接到它而不会感染 GNU 病毒)。我不是律师。

顺便说一句:真正的律师想指出,我仍然是 Sun Microsystems 的员工。 Sun UK 已不复存在。现在是 Oracle。)

更新(添加Thread.c 的位置:
http: //hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/Thread.c

For JDK6 you can download the source from java.net. For java.lang the story begins at j2se/src/share/native/java/lang/, and then search... JDK7 rearranges the directory structure a little.

Some methods, such as Object.hashCode, may be implemented by hotspot instead or in addition to through JNI/Java.

JDK6 is freely licensed through the Java Research License (JRL) and Java Internal Use License (JIUL). JDK7 and OpenJDK6 is licensed under GPL 2 with CLASSPATH exception (roughly speaking you can link to it without catching the GNU virus). I am not a lawyer.

(BTW: The real lawyers would like to point out that I am still an employee of Sun Microsystems. Sun UK is no more. It is now Oracle.)

Update (Adding location for Thread.c):
http://hg.openjdk.java.net/jdk7/jdk7/jdk/file/9b8c96f96a0f/src/share/native/java/lang/Thread.c

我三岁 2024-08-29 21:28:50

您可以查看 OpenJDK 的源代码(在 带有类路径异常的 GPLv2)。可能是研究 JDK 实现内部结构的最佳方法,除非您想受 Java 研究许可证,在这种情况下,您可以访问实际的 JDK 6 源

You can look at the source code for OpenJDK (licensed under GPLv2 with Classpath Exception). Probably the best way to study the JDK implementation internals, unless you want to be bound by the Java Research Licence, in which case you can access the actual JDK 6 source.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文