I've copied and created the coding of a JFreeChart demo into a class that I've created within my project.
I receive a java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: (<any>)void
when I try to compile the code.
The full error is below:
Exception in thread "main" java.lang.RuntimeException: Uncompilable source code - Erroneous sym type: (<any>)void
at JFreeChartExample.<init>(JFreeChartExample.java:32)
at JFreeChartExample.main(JFreeChartExample.java:45)
Java Result: 1
Line java:32 -plot.setDirection(Rotation.CLOCKWISE);
If I open the code and highlight over setDirection, it says The type of setDirection(Rotation) is erroneous
Below is the coding of the demo.
import javax.swing.JFrame;
import org.jfree.chart.ChartFactory;
import org.jfree.chart.ChartPanel;
import org.jfree.chart.JFreeChart;
import org.jfree.chart.plot.PiePlot;
import org.jfree.data.general.DefaultPieDataset;
import org.jfree.util.Rotation;
public class JFreeChartExample extends JFrame {
public JFreeChartExample(String frameTitle, String chartTitle) {
super(frameTitle);
//Creates a sample defaultPieDataset
DefaultPieDataset defaultPieDataset = new DefaultPieDataset();
defaultPieDataset.setValue("c/c++", 19);
defaultPieDataset.setValue("java", 46);
defaultPieDataset.setValue("php", 35);
// based on the defaultPieDataset we create the chart
JFreeChart pieChart = ChartFactory.createPieChart3D(chartTitle, defaultPieDataset, true, true, false);
PiePlot plot = (PiePlot) pieChart.getPlot();
plot.setStartAngle(290);
plot.setDirection(Rotation.CLOCKWISE);
plot.setForegroundAlpha(0.5f);
// Adding chart into a chart panel
ChartPanel chartPanel = new ChartPanel(pieChart);
// setting default size
chartPanel.setPreferredSize(new java.awt.Dimension(300, 200));
// add to contentPane
setContentPane(chartPanel);
}
public static void main(String[] args) {
JFreeChartExample chart = new JFreeChartExample("Language Usage Statistics", "Which language are you Learning?");
chart.pack();
chart.setVisible(true);
}
}
I have imported both jcommon-1.018.jar and jfreechart-1.0.15.jar libraries into my project.
What I have noticed is, If I create a complete new project just for this demo, it works fine but when I incorporate it into my existing project, I'm receiving this error.
Any help would be appreciated!
Thanks
When I navigate to the source
public void setDirection(Rotation direction) {
// <editor-fold defaultstate="collapsed" desc="Compiled Code">
/* 0: new #3 // class java/lang/RuntimeException
* 3: dup
* 4: ldc #4 // String Uncompilable source code - cannot find symbol\n symbol: class Rotation\n location: class org.jfree.chart.plot.PiePlot
* 6: invokespecial #5 // Method java/lang/RuntimeException."<init>":(Ljava/lang/String;)V
* 9: athrow
* */
// </editor-fold>
}