在linux下,我把运行jfreechart相应的包jfreechart-0.9.18.jar、jcommon-0.9.3.jar等已经copy到tomcat的common/lib下,但是,程序运行还是提示如下错误:
java.lang.NoClassDefFoundError
org.jfree.chart.axis.Axis.<init>(Axis.java:180)
at org.jfree.chart.axis.CategoryAxis.<init>(CategoryAxis.java:137)
at org.jfree.chart.axis.CategoryAxis3D.<init>(CategoryAxis3D.java:78)
at org.jfree.chart.ChartFactory.createBarChart3D(ChartFactory.java:507)
解决的办法是:
编辑/etc/profile文件,在最后加入export CATALINA_OPTS='-Djava.awt.headless=true'
即可