0

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>
}
  • 1
    this code compiles & runs fine under Eclipse. Would suggest to clean your project in Netbeans & retry – Reimeus Jul 13 '13 at 20:50
  • Is there any special way to clean my project? I've tried Clean and Build Project but the error persists for this project. – M.I Randeree Jul 13 '13 at 21:05
  • ok, try the solution outlined in [this answer](http://stackoverflow.com/questions/4386076/uncompilable-source-code-runtimeexception-in-netbeans?answertab=votes#tab-top) – Reimeus Jul 13 '13 at 21:09
  • You were right , The Netbeans cache had alot of ..unwanted cache in it. I've cleared it and it has worked! Thanks , this is resolved. – M.I Randeree Jul 13 '13 at 21:11

0 Answers0