1

I copied a java program (called SwingAccumulator.java) which enables the user to enter integers one by one in a GUI and prints the current sum. I then copied a class written by someone else (called createGraph()) to plot a line graph. I'm trying to combine the 2, calling the program ODESolver.java. The second part (createGraph()) uses JFreeChart. I've just tried to call the createGraph() method from the SwingAccumulator part and I get the following error:

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError

Can anyone help me to understand what is causing these errors and how to fix them please?

Full details of my error are as follows:

Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError
    at odesolver.ODESolver.createGraph(ODESolver.java:66)
    at odesolver.ODESolver.<init>(ODESolver.java:60)
    at odesolver.ODESolver$2.run(ODESolver.java:101)
    at java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    at java.awt.EventQueue.dispatchEventImpl(EventQueue.java:733)
    at java.awt.EventQueue.access$200(EventQueue.java:103)
    at java.awt.EventQueue$3.run(EventQueue.java:694)
    at java.awt.EventQueue$3.run(EventQueue.java:692)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(ProtectionDomain.java:76)
    at java.awt.EventQueue.dispatchEvent(EventQueue.java:703)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:242)
    at java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:161)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:150)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:146)
    at java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:138)
    at java.awt.EventDispatchThread.run(EventDispatchThread.java:91)
Caused by: java.lang.RuntimeException: Uncompilable source code - package org.jfree.util does not exist
    at org.jfree.data.general.Series.<clinit>(Series.java:69)
    ... 17 more  

I suppose the classpath has not been set properly. I've just set it to the folder containing the jfreechart-1.0.16 folder. I was wondering if the JCommon classpath hasn't been set, but I thought JCommon was included in the jfreechart-1.0.16 folder.

George Tomlinson
  • 1,871
  • 3
  • 17
  • 32

1 Answers1

2

As @Foo Bar User comments, both jfreechart and jcommon must be in the classpath:

java -cp lib/jfreechart-1.0.16.jar:lib/jcommon-1.0.20.jar 
    org.jfree.chart.demo.TimeSeriesChartDemo1
trashgod
  • 203,806
  • 29
  • 246
  • 1,045