如何从源代码(JDK 中的 src.zip)构建 java JRE?
令人惊讶的是我找不到这个问题的答案。
我正在尝试从源代码重建 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 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(4)
您有更好的机会使用 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...
摘自:
http: //www.java.net/forum/topic/jdk/java-se-snapshots-project-feedback/it-possible-just-build-rtjar
因此,当您对 src 内的所有 java 文件说 javac 时。 zip 它不会编译,因为依赖关系图已损坏(缺少生成的文件)
另请看一下: 哪里可以获得 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?
如果要改变多个类,只需要编译这些类即可。除非您打算替换它,否则不需要编译整个 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.
重新审视问题后。对任何这些文件执行 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.