环境:jdk1.4、webLogic8.1
系统liunx
1、在编译程序的过程中,报出如下的错误:
BarChartDemo.java:51: cannot resolve symbol
symbol : class CategoryDataset
location: class demo.BarChartDemo
private static CategoryDataset getDataSet() {
^
BarChartDemo.java:52: cannot resolve symbol
symbol : class DefaultCategoryDataset
location: class demo.BarChartDemo
DefaultCategoryDataset dataset = new
DefaultCategoryDataset();
^
这是由于未找到相应的类,在程序前面加上以下两句即可解决这个问题:
import org.jfree.data.category.CategoryDataset;
import org.jfree.data.category.DefaultCategoryDataset;
2、The 'quality' must be in the range 0.0f to 1.0f
这是因为ChartUtilities.writeChartAsJPEG(res.getOutputStream
(),100,chart,graphWidth,graphHigh,null);
限制quality必须小于等于1,所以修改一下
把100改成 1.0f就可以显示了
3.Can't connect to X11 window server using ':0.0' as the value of the
DISPLAY variable
这是因为JfreeChar寻求liunx下面没有开启X11 server服务;
解决方法:在JSP页面前面加System.setProperty
("java.awt.headless","true");