在单个应用程序中修补JDK中的错误 [英] Patching a bug in the JDK for an individual application
问题描述
所以找到了这个的源代码,我将如何实现某种补丁,这样可以让我修复我的应用程序的这个错误。显然,如果我解决了这个问题,我会将其贡献给未来的JDK,但现在我只是想要一个快速修复。
我以为一个简单的google搜索修补JDK等会引起大量的信息,但实际上并没有任何东西。
有人可以解释如何补丁,至少让我在右边
修补JavaFX类而不实际构建整个JDK或JavaFX是非常容易的。我之前曾经为SVGPath类做了例子。
- 从与JDK分发的源zip中提取类源,根据其包名将它添加到您的项目中的正确文件夹中。在我的情况下,这将是
javafx / scene / shape / SVGPath.java
。 - 明确地添加
$ { JDK_HOME} /jre/lib/ext/jfxrt.jar
到你的类路径。 - 使用java选项-Djava.ext.dirs =运行程序。
此过程对于能够覆盖jfxrt.jar中的现有类是至关重要的。
就是这样。 p>
I have established through another question that the problem I'm having with my JavaFX program is due to a bug in the JDK that is not going to be fixed anytime soon. I was even informed that the bug is in PrismTextLayout.
So having found the source code for this, how would I implement some kind of patch which would allow me to fix this bug for my application only. Obviously if I did fix the problem, I would contribute it back to a future JDK, but for now I just want a quick fix.
I thought a simple google search for patching the JDK, etc would turn up heaps of information, but actually, virutally nothing.
Can someone, if not explain how to patch, at least point me in the right direction for some documentation on this subject.
Patching a JavaFX class without actually building the whole JDK or JavaFX is quite easy. I did that for example for the class SVGPath some time ago.
- Extract the class source from the source zip which is distributed with the JDK and add it to your project in the correct folder according to its package name. In my case this would be
javafx/scene/shape/SVGPath.java
. - Explicitly add
${JDK_HOME}/jre/lib/ext/jfxrt.jar
to your classpath. - Run your program with the java options "-Djava.ext.dirs=". This procedure is essential to be able to override the existing classes in jfxrt.jar.
That is it.
这篇关于在单个应用程序中修补JDK中的错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!