Java Metadata Extractor causes java.lang.NoClassDefFoundError

3.1k views Asked by At

I'm trying to use this library for Images Metadata Extraction in Java https://github.com/drewnoakes/metadata-extractor , using NetBeans.

I imported the file metadata-extractor-2.7.0.jar into the jar folder of the project, and like the readme says, I simply do:

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 );
}

but I always get

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)

There is something I need to configure in Netbeans before I start using this library?

1

There are 1 answers

4
Ozeta On

Just solved: It needs to import the Library xmpcore-5.1.2.jar to correctly work!