0

Im working on app that will show charts. I did already working classes using JFreeChart. I want to use them in other project. Im exporting it into "runnable jar with package required libraries into jar" option. When I add jar into new project I can see in referenced libraries my classes which I made and JFree libraries but when Im trying to use it, I get:

Exception in thread "main" java.lang.NoClassDefFoundError: org/jfree/chart/ChartPanel
Caused by: java.lang.ClassNotFoundException: org.jfree.chart.ChartPanel

Something like that works fine in project where I wrote classes:

Statistics stat=new Statistics(new Cards(path)); //showing chart

And same thing in new project with imported jar causes errors.

Frakcool
  • 10,915
  • 9
  • 50
  • 89
B.Maz
  • 1
  • 1

1 Answers1

0

Always double check your work and make sure you don't have an extra or misplaced } or ;. They can very easily ruin an otherwise perfect string of code.

  • The problem is with exporting project. I got one called f.e "Stats". Im creating class with main function and calling there : Statistics stat=new Statistics(new Cards(path)); works perfectly. Then I want to use exported project "Stats" in other project. Adding jar and same line of code into main and I get error. Its not problem with code.. – B.Maz Feb 22 '18 at 18:55
  • I would suggest initializing the jar before the main, and possibly making a new method for it if that doesn't help. – Nathan Chadsey Feb 22 '18 at 19:00