I have used three external jars:
- commons-math3-3.0.jar
- jcommon-1.0.23.jar
- jfreechart-1.9.19-experimental.jar
When I try to create a jar for my project, I get an error :
Exception in thread "main" java.lang.NoClassDefFoundError:
org/jfree/data/xy/XYDataset
at Main.main(Main.java:124) Caused by:
java.lang.ClassNotFoundException: org.jfree.data.xy.XYDataset
at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
Using IntelliJ to do the same.
I tried the following where :
- Go to file > Project Structure > Modules> Dependencies
- Click on + and add all the external libraries with scope as "Compile"
- Click ok and Apply
- Build Artifacts and jar is created.
Please suggest.