How to use jfreechart in unix

耗尽温柔 提交于 2020-01-07 09:43:56

问题


I had a java program which uses jfreechart API to create histogram, which is running fine in windows system but the same is not running in unix system. It is saying NoClassDef exception. I have added the jfreechart jar to the lib in Unix... Do I need to do anything else to make it run?


回答1:


NoClassDef exceptions are really only thrown for the fact the class simply doesn't exist.

Are you running the application through an IDE? If so, make sure the jar is in the classpath. If not, make sure you're including it in the command prompt.

java -classpath thirdpartyjar.jar mainclass.java

There can be no reason for this exception other than the class doesn't exist or the lib is in the wrong place.




回答2:


Be sure that both the jfreechart and jcommon JARs are on the classpath, along with your class.

In this example, the required libraries are cited in the Class-Path attribute of the JAR's manifest:

$ java -cp jfreechart-1.0.14-demo.jar demo.BarChartDemo1

In this example, DTSCTest.class is in build/classes, the the libraries are in dist/lib:

$ java -cp build/classes:dist/lib/* chart.DTSCTest

See java for details.



来源:https://stackoverflow.com/questions/15385122/how-to-use-jfreechart-in-unix

标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!