如何从源代码(JDK 中的 src.zip)构建 java JRE?

发布于 2024-10-16 19:24:33 字数 165 浏览 3 评论 0原文

令人惊讶的是我找不到这个问题的答案。

我正在尝试从源代码重建 java JRE。我通过解压JDK中的src.zip文件来获取java JRE源。

对 JRE 进行任何更改后,如何将新源代码编译回 .java 文件(之后我可以将其压缩到 rt.jar 文件中)。

谢谢。

Surprisingly enough I couldn't find the answer to this question.

I am trying to rebuild the java JRE from source. I obtain the java JRE source by extracting the src.zip file in the JDK.

After making any changes I need to make to the JRE, how do I compile the new source back into .java files (after which I can compress it into the rt.jar file).

Thanks.

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

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

发布评论

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

评论(4

温折酒 2024-10-23 19:24:33

您有更好的机会使用 OpenJDK(Oracle/Sun 未来 JDK 的基础)。
http://openjdk.java.net/

但你实际上想改变什么?也许有更好的方法...

You have better chances using OpenJDK (the base of Oracle/ Sun's future JDKs).
http://openjdk.java.net/

But what do you want to change actually? Maybe there is a better way...

多彩岁月 2024-10-23 19:24:33

一些组成的 Java 源代码
rt.jar 在构建过程中生成
过程,来自脚本和其他方式。
一些属性文件也
以这种方式生成,并且一些
属性文件被转换成Java
也有助于
rt.jar。所以没有做完整的
首先构建并填充
'gensrc' 目录,你不会拥有全部
组成 rt.jar 的源代码。

摘自:
http: //www.java.net/forum/topic/jdk/java-se-snapshots-project-feedback/it-possible-just-build-rtjar

因此,当您对 src 内的所有 java 文件说 javac 时。 zip 它不会编译,因为依赖关系图已损坏(缺少生成的文件)

另请看一下: 哪里可以获得 rt.jar 的完整源代码?

Some of the Java sources that make up
rt.jar are generated during the build
process, from scripts and other means.
Some of the properties files are also
generated this way, and some of the
properties files are turned into Java
source that also contributes to
rt.jar. So without doing a complete
build first and populating the
'gensrc' directory, you won't have all
the sources that make up rt.jar.

Taken from:
http://www.java.net/forum/topic/jdk/java-se-snapshots-project-feedback/it-possible-just-build-rtjar

So when you say javac on all the java files inside src.zip it won't compile as the dependency graph is broken (missing generated files)

Also have a look at this: Where to get full source code for rt.jar?

吲‖鸣 2024-10-23 19:24:33

如果要改变多个类,只需要编译这些类即可。除非您打算替换它,否则不需要编译整个 JDK。

如果您只想修补它,请创建更改的类的 JAR 并将其添加到引导类路径中。

If you want to change a number of class, you only need to compile those classes. You don't need to compile the whole JDK unless you intend to replace it.

If you just want to patch it, create a JAR of your changed classes and add this to the boot class path.

心凉怎暖 2024-10-23 19:24:33

重新审视问题后。对任何这些文件执行 Javac 都将允许您重建它们。另外,您不会将 .java 文件编译为 .java 文件,它们会成为 .class 文件。您可以编写 ANT 构建脚本来为您处理繁重的工作。

After revisiting the question. Javac on any of those files will allow you to rebuild them. Also you don't compile .java files into .java files they become .class files. You can write an ANT build script to handle the heavy work for you.

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