2

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?

Drew Noakes
  • 300,895
  • 165
  • 679
  • 742
Ozeta
  • 321
  • 4
  • 18

1 Answers1

5

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

Ozeta
  • 321
  • 4
  • 18
  • Yep, that's all you need. Was this somehow not clear from the README file? If not, how could it be improved? – Drew Noakes Dec 17 '14 at 08:06
  • Hi Drew, I'm glad to talk with you! Consider that I'm only a student so I'm not too much into Coding and Libraries stuff, so when I opened the Zip I installed just the Metadataextractor and not the other library :D. Anyway, in this [README](https://github.com/drewnoakes/metadata-extractor/blob/master/README.md) there isn't any reference to xmpcore-5.1.2.jar, so you could just add it – Ozeta Dec 17 '14 at 08:46
  • 1
    I have added some information to the _Getting Started_ page which is linked to from the README. Thanks for the feedback. – Drew Noakes Dec 17 '14 at 09:43
  • 1
    Those using Maven to access the [`metadata-extractor package`](http://search.maven.org/#search%7Cgav%7C1%7Cg%3A%22com.drewnoakes%22%20AND%20a%3A%22metadata-extractor%22) do not need to worry, as `xmpcore` is a declared dependency, and therefore downloaded automatically. – Drew Noakes Feb 01 '15 at 14:32