Is JVM open source code?

前端 未结 4 1528
萌比男神i
萌比男神i 2020-11-28 04:08

Is JVM open source code? If not, how can I get the code of JVM?

4条回答
  •  庸人自扰
    2020-11-28 04:28

    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.

    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.

    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.

    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.

提交回复
热议问题