我复制了一个 java 程序(称为 SwingAccumulator.java),它使用户能够在 GUI 中一个一个地输入整数并打印当前的总和。然后我复制了一个由其他人编写的类(称为 createGraph())来绘制折线图。我正在尝试结合 2,调用程序 ODESolver.java。第二部分 (createGraph()) 使用 JFreeChart。我刚刚尝试从 SwingAccumulator 部分调用 createGraph() 方法,但出现以下错误:
线程“AWT-EventQueue-0”中的异常 java.lang.ExceptionInInitializerError
谁能帮助我了解导致这些错误的原因以及如何解决它们?
我的错误的详细信息如下:
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
我想类路径没有正确设置。我刚刚将它设置为包含 jfreechart-1.0.16 文件夹的文件夹。我想知道是否没有设置 JCommon 类路径,但我认为 JCommon 包含在 jfreechart-1.0.16 文件夹中。