当我运行项目时,我的Eclipse安装没有任何问题,但是如果我导出了与runnable jar
文件相同的文件,那么我将获得如下异常:
Exception in thread "Thread-2" java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: Provider com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi could not be instantiated
at java.util.ServiceLoader.fail(Unknown Source)
at java.util.ServiceLoader.access$100(Unknown Source)
at java.util.ServiceLoader$LazyIterator.nextService(Unknown Source)
at java.util.ServiceLoader$LazyIterator.next(Unknown Source)
at java.util.ServiceLoader$1.next(Unknown Source)
at javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis(Unknown Source)
at javax.imageio.spi.IIORegistry.<init>(Unknown Source)
at javax.imageio.spi.IIORegistry.getDefaultInstance(Unknown Source)
at javax.imageio.ImageIO.<clinit>(Unknown Source)
at emiratesid.ae.sample.MainFrame.displayPublicData(MainFrame.java:837)
at emiratesid.ae.sample.MainFrame.loadPublicData(MainFrame.java:754)
at emiratesid.ae.sample.MainFrame$PublicDataThread.run(MainFrame.java:1267)
at java.lang.Thread.run(Unknown Source)
Caused by: java.lang.IllegalArgumentException: vendorName == null!
at javax.imageio.spi.IIOServiceProvider.<init>(Unknown Source)
at javax.imageio.spi.ImageReaderWriterSpi.<init>(Unknown Source)
at javax.imageio.spi.ImageReaderSpi.<init>(Unknown Source)
at com.sun.media.imageioimpl.plugins.jpeg.CLibJPEGImageReaderSpi.<init>(CLibJPEGImageReaderSpi.java:80)
at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
at java.lang.reflect.Constructor.newInstance(Unknown Source)
at java.lang.Class.newInstance(Unknown Source)
... 11 more
Exception in thread "Thread-3" java.lang.NoClassDefFoundError: Could not initialize class javax.imageio.ImageIO
at emiratesid.ae.sample.MainFrame.displayPublicData(MainFrame.java:837)
at emiratesid.ae.sample.MainFrame.loadPublicData(MainFrame.java:754)
at emiratesid.ae.sample.MainFrame$PublicDataThread.run(MainFrame.java:1267)
at java.lang.Thread.run(Unknown Source)
有没有人经历过这种例外。寻求帮助。
答案 0 :(得分:0)
您可以编译以下类并将其作为java -cp your_runable.jar:. Check
运行。
public class Check {
public static void main(String[] args) {
System.out.println(
com.sun.media.imageioimpl.common.PackageUtil.getVendor()
);
}
}
输出应类似于运行java -cp jai_imageio-1.1.jar:. Check
Sun Microsystems, Inc.