1

我想在我的应用程序中绘制一个图表,所以我下载了它并将其添加到我的项目中。jmathplot.jar

当我向我的框架添加一个字段时:

private PlotPanel plot = new Plot2DPanel();

我在编译时收到一条令人讨厌的长异常消息:

线程“AWT-EventQueue-0”中的异常 java.lang.NoClassDefFoundError: org/math/io/StringPrintable at java.lang.ClassLoader.defineClass1(Native Method) at java.lang.ClassLoader.defineClass(Unknown Source) at java。 security.SecureClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.defineClass(Unknown Source) at java.net.URLClassLoader.access$100(Unknown Source) at java.net.URLClassLoader$1.run(Unknown Source) at java. net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) 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) at org.math.plot.canvas.PlotCanvas.(PlotCanvas.java:491) at org.math.plot.canvas.Plot2DCanvas.(Plot2DCanvas.java:25) at org.math.plot.Plot2DPanel。 (Plot2DPanel.java:47) 在 Frame1.initialize(Frame1.java:39) 在 Frame1.(Frame1.java:31) 在 Frame1$1.run(Frame1.java:18) 在 java.awt.event.InvocationEvent.dispatch (未知来源)在 java.awt.EventQueue.access$500(未知来源)在 java.awt.EventQueue$3.run(未知来源)在 java.awt.EventQueue$3 的 java.awt.EventQueue.dispatchEventImpl(未知来源)。在 java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source) 在 java.awt.EventQueue 的 java.security.AccessController.doPrivileged(Native Method) 运行(Unknown Source)。dispatchEvent(Unknown Source) at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents( Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 原因:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多还有 32 个还有 32 个pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents( Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 原因:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多pumpOneEventForFilters(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents( Unknown Source) at java.awt.EventDispatchThread.run(Unknown Source) 原因:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run( Unknown Source) 引起:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多pumpEventsForFilter(Unknown Source) at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.pumpEvents(Unknown Source) at java.awt.EventDispatchThread.run( Unknown Source) 引起:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多java.awt.EventDispatchThread.run(Unknown Source) 处的 EventDispatchThread.pumpEvents(Unknown Source) 原因:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多java.awt.EventDispatchThread.run(Unknown Source) 处的 EventDispatchThread.pumpEvents(Unknown Source) 原因:java.lang.ClassNotFoundException: org.math.io.StringPrintable 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) ... 32 更多ClassLoader.loadClass(Unknown Source) ... 32 更多ClassLoader.loadClass(Unknown Source) ... 32 更多

怎么了?

编辑

好的。我导入了jmathio.jar. 现在我得到了错误:

java.lang.NullPointerException
    at javax.swing.ImageIcon.<init>(Unknown Source)
    at org.math.plot.components.PlotToolBar.<init>(PlotToolBar.java:61)
    at org.math.plot.PlotPanel.addPlotToolBar(PlotPanel.java:149)
    at org.math.plot.PlotPanel.<init>(PlotPanel.java:59)
    at org.math.plot.PlotPanel.<init>(PlotPanel.java:67)
    at org.math.plot.Plot2DPanel.<init>(Plot2DPanel.java:31)
    at Frame1.<init>(Frame1.java:10)
    at Frame1$1.run(Frame1.java:19)
    at java.awt.event.InvocationEvent.dispatch(Unknown Source)
    at java.awt.EventQueue.dispatchEventImpl(Unknown Source)
    at java.awt.EventQueue.access$500(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.awt.EventQueue$3.run(Unknown Source)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.security.ProtectionDomain$1.doIntersectionPrivilege(Unknown Source)
    at java.awt.EventQueue.dispatchEvent(Unknown Source)
    at java.awt.EventDispatchThread.pumpOneEventForFilters(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForFilter(Unknown Source)
    at java.awt.EventDispatchThread.pumpEventsForHierarchy(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.pumpEvents(Unknown Source)
    at java.awt.EventDispatchThread.run(Unknown Source)
4

1 回答 1

0

你需要在你的类路径中包含 https://github.com/yannrichet/jmathio/blob/master/dist/jmathio.jar jar。jmathplot.jar取决于jmathio.jar。所以下载这个并将它放在你的类路径中,它应该可以工作

于 2016-05-05T12:49:00.073 回答