进行一些更改后重建 JDK1.6.8
我想在java.util包中的currency.java进行一些更改后重建JDK1.6。那我该怎么办呢?有没有编译器或构建器可以制作自定义版本的 JDK? 我尝试 $ javac src/java/util/currency.java 但它不起作用。
I want to rebuild JDK1.6 after some changes in currency.java in the java.util package. so how can I do it? is there any compiler or builder to make a custom version of JDK?
I try $ javac src/java/util/currency.java but it did not work.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您不应该构建整个 JDK。您唯一需要的就是编译您的类,将其放入
.jar
并将其放入 JRE 认可的文件夹。You should not build the whole JDK. Only thing you need is compile your class, put it into a
.jar
and place it in endorsed folder of a JRE.我在源代码存储库中找到了 OpenJDK 6 的构建说明:
更新 - 几年后重新审视这个问题,我发现了以下有用的博客条目,其中包含许多 Java 版本的“构建自述文件”文件的链接:
希望它能留在那里,并保持最新状态!
但是,是的......如果您刚刚更改了一个类,那么“认可目录”方法是一个更好的主意;请参阅@kan的回答。
最后,修改标准类库以使应用程序正常工作通常是一个坏主意/不可取:
您的代码立即不可移植。它仅适用于您的私有风格 Java。
每次升级 Java 版本时,您都必须重新同步源并重建。 (“认可”方法更简单,但每次 Java 更新时您仍然需要做一些工作。)
重新分发修改后的 Java 可能会出现法律问题。与知识产权律师交谈...
I found these build instructions for OpenJDK 6 in the source code repository:
UPDATE - revisiting this after a couple of years, I came across the following useful blog entry that has links to "Build README" files for a number of Java versions:
Lets hope it stays there, and stays current!
But yea ... if you have just changed one class, then the "endorsed directory" approach is a better idea; see @kan's answer.
Finally, it is generally a bad idea / undesirable to modify the standard class libraries to make your application work:
Your code is immediately non-portable. It will only work on your private flavor of Java.
Each time you upgrade your Java version you have to resync the sources and rebuild. (The "endorsed" approach is simpler, but you still have work to do on each Java update.)
There might be legal issues with redistribution of your modified Java. Talk to an IP lawyer ...