覆盖rt.jar中的单个类 [英] Overriding single classes from rt.jar

查看:326
本文介绍了覆盖rt.jar中的单个类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在寻找一种巧妙的方法来覆盖引导类路径中的类, rt.jar
原因是OpenJDK7错误 http://bugs.sun.com/ bugdatabase / view_bug.do?bug_id = 7104625

I'm looking for a neat way to override a class from the bootstrap class path, rt.jar. The reason is OpenJDK7 bug http://bugs.sun.com/bugdatabase/view_bug.do?bug_id=7104625

此错误的修复程序是一个微不足道的(请参阅链接的邮件列表帖子)更改为 sun.awt.X11.XComponentPeer 。所以我想知道是否有一种简单的方法可以在我的类路径上覆盖这个受影响的类,而无需重新打包/重建rt.jar(因此修复程序不会在下次自动更新OpenJDK时丢失)。

The fix for this bug is a trivial (see linked mailing list post) change to sun.awt.X11.XComponentPeer. So I was wondering if there is an easy way to override just this one affected class on my classpath, without having to repack/rebuild rt.jar (so the fix isn't lost on the next automatic update of OpenJDK).

理想情况下,它也会影响Eclipse ...

Ideally, it would also affect Eclipse...

我假设 java -Djava。 system.class.loader = myClassLoader 会起作用吗?有没有其他方法来覆盖具有这样的修补程序的单个类? (注意:在我自己的代码中没有使用,但在Java AWT代码中很深)

I assume that java -Djava.system.class.loader=myClassLoader would work? Is there any other way to override a single class with such a "hotfix"? (Note: not used in my own code, but deep in Java AWT code)

推荐答案

您可以使用VM参数 -Xbootclasspath / p 将带有修补类的自己的JAR文件添加到引导类路径。

You can use the VM parameter -Xbootclasspath/p to prepend your own JAR file with the patched class to the boot class path.

这篇关于覆盖rt.jar中的单个类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆