Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Overriding single classes from rt.jar

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

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).

Ideally, it would also affect Eclipse...

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)

like image 261
Has QUIT--Anony-Mousse Avatar asked Dec 17 '22 06:12

Has QUIT--Anony-Mousse


1 Answers

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

like image 171
Ingo Kegel Avatar answered Dec 18 '22 20:12

Ingo Kegel