简体   繁体   English

JVM是开源代码吗?

[英]Is JVM open source code?

Is JVM open source code? JVM是开源代码吗? If not, how can I get the code of JVM? 如果没有,如何获取JVM代码?

It depends entirely on which JVM you use. 这完全取决于您使用哪个JVM。

If you use the OpenJDK JVM, then you can get the source code from here . 如果使用OpenJDK JVM,则可以从此处获取源代码。
If you use the Kaffe JVM, you can get the source from here . 如果使用Kaffe JVM,则可以从此处获取源代码。
If you use the Sun JVM version 6 or later, then you can get the source from here . 如果使用Sun JVM 6或更高版本,则可以从此处获取源。

If you use a Sun JVM earlier than 6, then you can often get the source under an academic license. 如果您使用的Sun JVM早于6,则通常可以通过学术许可获得该源。 If you use an IBM, Oracle, HP, or other JVM, then the source is not open. 如果使用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 . 仍然可以通过上面的链接访问Version 6源,或者可以通过此链接访问它。 This latter link also includes a handy genealogy table that shows how the Oracle JDK and OpenJDK versions match with each other. 后面的链接还包括一个方便的族谱表,该表显示了Oracle JDK和OpenJDK版本如何相互匹配。

Additionally, a more up to date version of the Java 7 source can be found here . 另外,可以在此处找到Java 7源的最新版本。 This also includes the fixes for the releases of Java 7 since GA. 这也包括自GA以来对Java 7发行版的修复。

And, of no surprise to anyone, the Java 8 sources can be found here . 而且,对于任何人来说,都可以在这里找到Java 8源,这不足为奇。

在这里查看热点JVM: http : //openjdk.java.net/groups/hotspot/

The core part of the JVM is in the hotspot module of the OpenJDK. JVM的核心部分在OpenJDK的hotspot模块中。 However what you need is more likely to be in src.zip. 但是,您最需要的是src.zip。

The hotspot module apart of those classes is 这些类之外的热点模块是

  • mostly in C++ 主要是用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. 通常不是您要找的东西。

For this reason if you want to know how the JVM runs it is best to look at the commonly used classes. 因此,如果您想知道JVM的运行方式,最好查看常用的类。 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. 例如,即使是像lambda在运行时实际工作的方式那样低级的内容,大部分也都在src.zip中,而在JVM中却没有太多。

Most of the source for the libraries come with the JDK in the src.zip file. 库的大多数源代码都随src.zip文件中的JDK一起提供。 Your IDE will use that automatically. 您的IDE将自动使用它。 You are much better off being familiar with the classes in these libraries than playing with the JDK itself. 与熟悉JDK本身相比,熟悉这些库中的类要好得多。

There is no open source jvm even if there were you can't bypass Oracle's stupid classpath exception. 即使您无法绕过Oracle愚蠢的类路径异常,也没有开源的jvm。 In short openjdk is still tied to $$ driven scheme that forces you to contend with a comercial vm. 简而言之,openjdk仍然与$$驱动方案紧密相关,该方案迫使您与商业虚拟机竞争。 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. 与Microsoft没什么两样,您可以在C#甚至免费提供.net库的情况下使用C#,但可以维护对Visual Studio的控制,这实际上迫使最终用户使用Windows作为所选环境。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM