2

以下のコードは、以前のバージョンでは問題なく動作しますが、Java 7 にアップグレードした後は動作しませんでした。

誰でも助けることができますか?

コード:

if (imageFile.exists())

System.out.println(imageFile.getPath()+" :"+ imageFile.getName());
      // prepare to read the input

final FileInputStream fis = new FileInputStream (imageFile);  

ImageInputStreamiis=null;
iis = ImageIO.createImageInputStream(fis);          
final Iterator<ImageReader> imageReaders = ImageIO.getImageReaders(iis);
ImageReader reader = imageReaders.next();
reader.setInput(iis, true, false);
エラー:
C:\Users\apps\Documents\DSC_1244.jpg :DSC_1244.jpg
スレッド「AWT-EventQueue-0」の例外 java.util.ServiceConfigurationError: javax.imageio.spi.ImageReaderSpi: プロバイダ it.tidalwave.imageio.io.FileImageInputStream2Spi がサブタイプではありません
    java.util.ServiceLoader.fail (ServiceLoader.java:231) で
    java.util.ServiceLoader.access$300 で (ServiceLoader.java:181)
    java.util.ServiceLoader$LazyIterator.next(ServiceLoader.java:369) で
    java.util.ServiceLoader$1.next(ServiceLoader.java:445) で
    javax.imageio.spi.IIORegistry.registerApplicationClasspathSpis (IIORegistry.java:210) で
    javax.imageio.spi.IIORegistry で。(IIORegistry.java:138)
    javax.imageio.spi.IIORegistry.getDefaultInstance (IIORegistry.java:159) で
    javax.imageio.ImageIO で。(ImageIO.java:65)
    hk.dawntech.digps2map.PhotoManagerImagePreview.paint (PhotoManagerImagePreview.java:50) で
    javax.swing.JComponent.paintToOffscreen(JComponent.java:5221) で
    javax.swing.RepaintManager$PaintManager.paintDoubleBuffered(RepaintManager.java:1482) で
    javax.swing.RepaintManager$PaintManager.paint(RepaintManager.java:1413) で
    javax.swing.RepaintManager.paint(RepaintManager.java:1206)で
    javax.swing.JComponent._paintImmediately(JComponent.java:5169)で
    javax.swing.JComponent.paintImmediately(JComponent.java:4980)で
    javax.swing.RepaintManager.paintDirtyRegions (RepaintManager.java:770) で
    javax.swing.RepaintManager.paintDirtyRegions (RepaintManager.java:728) で
    javax.swing.RepaintManager.prePaintDirtyRegions (RepaintManager.java:677) で
    javax.swing.RepaintManager.access$700 で (RepaintManager.java:59)
    javax.swing.RepaintManager$ProcessingRunnable.run(RepaintManager.java:1621) で
    java.awt.event.InvocationEvent.dispatch(InvocationEvent.java:251)
    java.awt.EventQueue.dispatchEventImpl(EventQueue.java:721) で
    java.awt.EventQueue.access$200 (EventQueue.java:103) で
    java.awt.EventQueue$3.run(EventQueue.java:682) で
    java.awt.EventQueue$3.run(EventQueue.java:680) で
    java.security.AccessController.doPrivileged(ネイティブメソッド)で
    java.security.ProtectionDomain$1.doIntersectionPrivilege (ProtectionDomain.java:76) で
    java.awt.EventQueue.dispatchEvent(EventQueue.java:691)で
    java.awt.EventDispatchThread.pumpOneEventForFilters (EventDispatchThread.java:244) で
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:163) で
    java.awt.EventDispatchThread.pumpEventsForHierarchy (EventDispatchThread.java:151) で
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:147) で
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:139) で
    java.awt.EventDispatchThread.run(EventDispatchThread.java:97) で
4

1 に答える 1

1

ここで基本的に同じ問題である質問に答えました: Java 7 に切り替えた後、 ImageIO メソッドが機能しません

唯一の違いは、この例外がImageInputStreamSpiとして登録されようとしているために発生することImageReaderSpiです。

于 2013-10-02T07:25:27.877 に答える