StdDraw in Eclipse



所以我需要在StdDraw的帮助下绘制一些小.gif图片(它必须是StdDraw),但我遇到了一个非常愚蠢的错误。我的代码是:

        while(true){
            StdDraw.setXscale(-R,R);
            StdDraw.setYscale(-R,R);
            StdDraw.picture(0, 0, "starfield.jpg");
        }

其中R是双精度和星空.jpg是背景图片。

尝试运行它时遇到的错误是:

Exception in thread "main" sun.misc.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider it.tidalwave.imageio.arw.ARWImageReaderSpi not found
    at sun.misc.Service.fail(Service.java:129)
    at sun.misc.Service.access$000(Service.java:111)
    at sun.misc.Service$LazyIterator.next(Service.java:274)
    at javax.imageio.spi.IIORegistry$1.run(IIORegistry.java:224)
    at java.security.AccessController.doPrivileged(Native Method)
    at javax.imageio.spi.IIORegistry.registerInstalledProviders(IIORegistry.java:232)
    at javax.imageio.spi.IIORegistry.registerStandardSpis(IIORegistry.java:167)
    at javax.imageio.spi.IIORegistry.<init>(IIORegistry.java:120)
    at javax.imageio.spi.IIORegistry.getDefaultInstance(IIORegistry.java:142)
    at apple.awt.CToolkit.registerDefaultServices(CToolkit.java:1346)
    at apple.awt.CToolkit.<init>(CToolkit.java:154)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
    at sun.reflect.NativeConstructorAccessorImpl.newInstance(NativeConstructorAccessorImpl.java:39)
    at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(DelegatingConstructorAccessorImpl.java:27)
    at java.lang.reflect.Constructor.newInstance(Constructor.java:513)
    at java.lang.Class.newInstance0(Class.java:357)
    at java.lang.Class.newInstance(Class.java:310)
    at java.awt.Toolkit$2.run(Toolkit.java:859)
    at java.security.AccessController.doPrivileged(Native Method)
    at java.awt.Toolkit.getDefaultToolkit(Toolkit.java:826)
    at java.awt.Window.getToolkit(Window.java:1177)
    at java.awt.Window.init(Window.java:397)
    at java.awt.Window.<init>(Window.java:433)
    at java.awt.Frame.<init>(Frame.java:403)
    at java.awt.Frame.<init>(Frame.java:368)
    at javax.swing.JFrame.<init>(JFrame.java:158)
    at StdDraw.init(StdDraw.java:173)
    at StdDraw.<clinit>(StdDraw.java:145)
    at Sonnensystem.main(Sonnensystem.java:58)

由于这是一个非常巨大的错误,我无法通过Google找到任何解决方案,我自己也无法找到错误。因此,如果有人能指出我的方向,那就太好了!

我添加了 stdlib.jar 作为外部存档,如以下视频中所述:https://www.youtube.com/watch?v=taJovOCBPS4

好的,找到了解决方案,我需要将我的代码导出为 Runnable JAR,之后它按预期工作。

相关内容

  • 没有找到相关文章

最新更新