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

时间:2016-12-17 16:09:05

标签: java xml ant

我正在尝试在我的程序中导入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。

1 个答案:

答案 0 :(得分:1)

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

要解决此问题,请在源文件中将protected String getUserAgentStylesheet() {更改为public String getUserAgentStylesheet() {,然后再次运行ant build。

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