package does not exist

A discussion forum for JFreeChart (a 2D chart library for the Java platform).
Post Reply
Posts: 1
Joined: Fri Aug 24, 2018 11:09 pm
antibot: No, of course not.

package does not exist

Post by alaw2018 » Sat Aug 25, 2018 1:03 am

I am using JFreeChart to draw a 3D piechart. I am unable to get a clean compilation of my CreateChart class. I get errors stating that and org.jfree.chart.plot do not exist. I cannot understand why I do not this error for org.jfree.chart.ChartPanel and org.jfree.chart.JFreeChart since all files are located in the jfreechart-1.0.19 files I downloaded. I would appreciate whatever help you can provide me. Thanks!
The code is shown below:

import javax.swing.JFrame;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import; //Error: package does not exist
import; //Error: package does not exist
import org.jfree.chart.plot.PiePlot3D; //Error: package org.jfree.chart.plotl does not exist

public class CreateChart extends JFrame
public CreateChart(String appTitle, String chartTitle)
PieDataset dataset = createDataset();
JFreeChart chart = createChart(dataset, chartTitle);
ChartPanel chartPanel = new ChartPanel(chart);
chartPanel.setPreferredSize(new java.awt.Dimension(500, 300));

//Create the dataset:
private PieDataset createDataset()
DefaultPieDataset result = new DefaultPieDataset();
result.setValue("Windows", 65);
result.setValue("Linux", 15);
result.setValue("MAC", 20);
return result;

private JFreeChart createChart(PieDataset dataset, String title)
JFreeChart chart = ChartFactory.createPieChart3D(title, dataset, true, true, false);
PiePlot3D plot = (PiePlot3D)chart.getPlot(); //jfree-->chart-->plot-->PiePlot3D
return chart;


John Matthews
Posts: 491
Joined: Wed Sep 12, 2007 3:18 pm

Re: package does not exist

Post by John Matthews » Sat Aug 25, 2018 2:28 am

If you're using JFreeChart 1.0.19, verify that both jfreechart-1.0.19.jar and jcommon-1.0.23.jar are in your class path when compiling.

Code: Select all

export JFREE_HOME=/jfreechart
javac -cp .:$JFREE_HOME/lib/* …
If you're using JFreeChart 1.5, see Migration from JFreeChart 1.0.x.

Post Reply