英文:
How to check source code libraries of openJDK?
问题
我已安装了openJDK 17。然后我解压了lib/src.zip文件。那里有很多目录,我找不到像java.lang或java.util这样的包。我该如何找到它们?
我已尝试使用搜索等方法。此外,我知道可以使用IntelJ或Eclipse,但我想在不使用集成开发环境的情况下完成它。
英文:
I have installed openJDK 17. Then I have unzipped file lib/src.zip. There are a lot of directories and I cannot find packages like java.lang or java.util. How can I find it?
I have tried to use search and so on. Also, I know that I can use IntelJ or Eclipse for it, but I want to do it without IDEs
答案1
得分: 1
Java的src.zip的顶级目录 - 自Java 9以来 - 是模块。包java.lang是模块java.base的一部分。您可以在zip文件中的java.base/java/lang中找到java.lang中类的源代码。
对于模块名称,目录名称是完整的模块名称,而对于包名称,每个.分隔的部分代表一个嵌套目录(java.lang -> java/lang,java.lang.annotation -> java/lang/annotation,等等)。例如,java.lang.String的源代码位于文件java.base/java/lang/String.java中。
根据您的最终目标,克隆OpenJDK的GitHub存储库可能更有意义:
- https://github.com/openjdk/jdk17u 用于Java 17的当前状态
- https://github.com/openjdk/jdk 用于Java的主线开发
英文:
The top-level directories of Java's src.zip are - since Java 9 - the modules. The package java.lang is part of the module java.base. You can find the sources of classes in java.lang in java.base/java/lang inside the zip.
For module names, the directory name is the full module name, while for package names, each . separated part represents a nested directory (java.lang -> java/lang, java.lang.annotation -> java/lang/annotation, etc.). For example, the sources of java.lang.String are in the file java.base/java/lang/String.java
Depending on what your end goal is, it might make more sense to clone the GitHub repository of OpenJDK:
- https://github.com/openjdk/jdk17u for current state of Java 17
- https://github.com/openjdk/jdk for mainline development of Java
通过集体智慧和协作来改善编程学习和解决问题的方式。致力于成为全球开发者共同参与的知识库,让每个人都能够通过互相帮助和分享经验来进步。


评论