Java JVM 是开源代码吗?
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/2026093/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
Is JVM open source code?
提问by giri
Is JVM open source code? If not, how can I get the code of JVM?
JVM 是开源代码吗?如果没有,我如何获得JVM的代码?
采纳答案by D.C.
Have a look at hotspot JVM here: http://openjdk.java.net/groups/hotspot/
在此处查看热点 JVM:http: //openjdk.java.net/groups/hotspot/
回答by Paul Wagland
It depends entirely on which JVM you use.
这完全取决于您使用的 JVM。
If you use the OpenJDK JVM, then you can get the source code from here.
If you use the Kaffe JVM, you can get the source from here.
If you use the Sun JVM version 6 or later, then you can get the source from here.
如果您使用 OpenJDK JVM,那么您可以从这里获取源代码。
如果你使用 Kaffe JVM,你可以从这里获取源代码。
如果您使用 Sun JVM 版本 6 或更高版本,那么您可以从这里获取源代码。
If you use a Sun JVM earlier than 6, then you can often get the source under an academic license. If you use an IBM, Oracle, HP, or other JVM, then the source is not open.
如果您使用早于 6 的 Sun JVM,那么您通常可以获得学术许可下的源代码。如果您使用 IBM、Oracle、HP 或其他 JVM,则源未开放。
Update May 2013
2013 年 5 月更新
The Version 6 source can still be accessed by the above link, or it can be accessed via this link. This latter link also includes a handy genealogytable that shows how the Oracle JDK and OpenJDK versions match with each other.
Version 6 源码仍然可以通过上面的链接访问,也可以通过这个链接访问。后一个链接还包括一个方便的谱系表,显示 Oracle JDK 和 OpenJDK 版本如何相互匹配。
Additionally, a more up to date version of the Java 7 source can be found here. This also includes the fixes for the releases of Java 7 since GA.
此外,可以在此处找到 Java 7 源代码的更新版本。这还包括自 GA 以来 Java 7 版本的修复程序。
And, of no surprise to anyone, the Java 8 sources can be found here.
而且,毫不奇怪,可以在此处找到 Java 8 源代码。
回答by Peter Lawrey
The core part of the JVM is in the hotspot module of the OpenJDK. However what you need is more likely to be in src.zip.
JVM 的核心部分在 OpenJDK 的 hotspot 模块中。但是,您需要的更有可能在 src.zip 中。
The hotspot module apart of those classes is
除了这些类之外的热点模块是
- mostly in C++
- not always easy to understand. This has improved over the years and new code tends to be better as they are more aware that the code will have broader consumption.
- often not what you are looking for.
- 主要使用 C++
- 并不总是容易理解。多年来,这种情况有所改善,新代码往往会更好,因为他们更清楚代码将有更广泛的消费。
- 通常不是你要找的。
For this reason if you want to know how the JVM runs it is best to look at the commonly used classes. For example, even something as low level as how lambdas really work at runtime is mostly in the src.zip not much is in the JVM.
因此,如果您想了解 JVM 是如何运行的,最好查看常用类。例如,即使像 lambdas 在运行时真正如何工作这样低级的东西也大多在 src.zip 中,而在 JVM 中并不多。
Most of the source for the libraries come with the JDK in the src.zip file. Your IDE will use that automatically. You are much better off being familiar with the classes in these libraries than playing with the JDK itself.
大多数库的源代码都在 src.zip 文件中随 JDK 一起提供。您的 IDE 将自动使用它。熟悉这些库中的类比使用 JDK 本身要好得多。
回答by FlyingSocks
There is no open source jvm even if there were you can't bypass Oracle's stupid classpath exception. In short openjdk is still tied to $$ driven scheme that forces you to contend with a comercial vm. No different from Microsoft really, you can work with C# under what ever os they even provide .net libraries free but maintain control over Visual Studio which practically forces the end user to make use of Windows as the chosen environment.
即使有无法绕过 Oracle 愚蠢的类路径异常,也没有开源 jvm。简而言之,openjdk 仍然依赖于 $$ 驱动的方案,迫使您与商业虚拟机抗衡。与微软真的没有什么不同,你可以在他们甚至免费提供 .net 库的任何操作系统下使用 C#,但保持对 Visual Studio 的控制,这实际上迫使最终用户使用 Windows 作为选择的环境。