Java Metadata Extractor导致java.lang.NoClassDefFoundError

时间:2014-12-16 16:38:59

标签: java metadata extractor metadata-extractor

我正在尝试使用NetBeans将此库用于Java https://github.com/drewnoakes/metadata-extractor中的图像元数据提取。

我将文件metadata-extractor-2.7.0.jar导入到项目的jar文件夹中,就像自述文件所说的那样,我只是这样做:

File file = fc.getSelectedFile ();
try {
    Metadata metadata = ImageMetadataReader.readMetadata(file);
} catch ( ImageProcessingException ex ) {
    Logger.getLogger ( UserInterface.class.getName() ).log ( Level.SEVERE, null, ex );
} catch ( IOException ex ) {
    Logger.getLogger ( UserInterface.class.getName() ).log ( Level.SEVERE, null, ex );
}

但我总是得到

Exception in thread "AWT-EventQueue-0" java.lang.NoClassDefFoundError: com/adobe/xmp/XMPException
at com.drew.imaging.jpeg.JpegMetadataReader.<clinit>(Unknown Source)
at com.drew.imaging.ImageMetadataReader.readMetadata(Unknown Source)
at com.drew.imaging.ImageMetadataReader.readMetadata(Unknown Source)

在开始使用这个库之前,我需要在Netbeans中配置一些东西吗?

1 个答案:

答案 0 :(得分:4)

刚解决:需要导入Library xmpcore-5.1.2.jar才能正常工作!