这是什么:线程"AWT-EventQueue-0"中的异常; java.lang.ExceptionInInitializerError? [英] What is this: Exception in thread "AWT-EventQueue-0" java.lang.ExceptionInInitializerError?

查看:1035
本文介绍了这是什么:线程"AWT-EventQueue-0"中的异常; java.lang.ExceptionInInitializerError?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我复制了一个Java程序(称为SwingAccumulator.java),该程序使用户能够在GUI中一个接一个地输入整数并打印当前总和.然后,我复制了其他人编写的类(称为createGraph())以绘制折线图.我试图结合2,调用程序ODESolver.java.第二部分(createGraph())使用JFreeChart.我刚刚尝试从SwingAccumulator部分调用createGraph()方法,但出现以下错误:

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:

线程"AWT-EventQueue-0"中的异常java.lang.ExceptionInInitializerError

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  

我认为类路径没有正确设置.我已经将其设置为包含jfreechart-1.0.16文件夹的文件夹.我想知道是否尚未设置JCommon类路径,但我认为JCommon已包含在jfreechart-1.0.16文件夹中.

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.

推荐答案

作为@Foo Bar用户评论,jfreechartjcommon都必须在

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

这篇关于这是什么:线程"AWT-EventQueue-0"中的异常; java.lang.ExceptionInInitializerError?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
相关文章
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆