构建 JFreeChart ant 文件 "build-fx.xml"

Build JFreeChart ant file "build-fx.xml"

我正在尝试在我的程序中导入 import org.jfree.chart.fx.ChartViewer;。经过一些研究,我发现我需要构建 build-fx.xml 文件才能将此包包含在我的 JFreeChart jar 中。因此,我使用终端设置中的代码行来构建 ant ant -buildfile build-fx.xml 但我在下面的输出中看到了一个错误。我做错了什么吗?

C:\Users\dan\Desktop\jfreechart-1.0.19\ant>ant -buildfile build-fx.xml
Buildfile: C:\Users\danie\Desktop\jfreechart-1.0.19\ant\build-fx.xml

initialise:

compile:
    [mkdir] Created dir: C:\Users\danie\Desktop\jfreechart-1.0.19\build
    [javac] Compiling 629 source files to C:\Users\danie\Desktop\jfreechart-1.0.19\build
    [javac] C:\Users\danie\Desktop\jfreechart-1.0.19\source\org\jfree\chart\fx\ChartViewer.java:122: error: getUserAgentStylesheet() in ChartViewer cannot override getUserAgentStylesheet() in Region
    [javac]     protected String getUserAgentStylesheet() {
    [javac]                      ^
    [javac]   attempting to assign weaker access privileges; was public
    [javac] Note: Some input files use or override a deprecated API.
    [javac] Note: Recompile with -Xlint:deprecation for details.
    [javac] Note: Some input files use unchecked or unsafe operations.
    [javac] Note: Recompile with -Xlint:unchecked for details.
    [javac] 1 error

BUILD FAILED
C:\Users\dan\Desktop\jfreechart-1.0.19\ant\build-fx.xml:62: Compile failed; see the compiler error output for details.

Total time: 6 seconds

对不起,如果这很明显,这是我第一次不得不用 ant 构建 jar。

这是一个已知错误,修复起来相当简单。参见 here

要解决此问题,请将源文件中的 protected String getUserAgentStylesheet() { 更改为 public String getUserAgentStylesheet() {,然后 运行 重新构建 ant。

这应该会成功构建一个名为 jfreechart-1.0.19-fx.jar 的 jar 到 lib 文件夹