Import library in sketch not working

edited February 2014 in Library Questions

I have tried two of the possible methods in trying to import a library called "metadata-extractor" by drewnoakes.com into the sketch.

1) Drag and drop the JAR file into my sketch and used the import statement import com.drew.*; but it is still complaining that the library doesn't exist.

2) Placed the JAR file in the Processing folder in My Documents folder and import library using the "Import Library..." option but when I select the library, no import statement is added automatically like the other libraries behave except for a blank line is inserted.

What do I have to do in order to import this library into the sketch?

Answers

  • edited February 2014

    If you look at the API for this library here you will see in the top left pane a list of packages - you have to import some or all of these depending on what you want to use from the library.

    Here are the first two

    import com.drew.imaging.*;
    import com.drew.imaging.bmp.*; 
    

    Note: The JAR file for this library should be placed inside a folder called code inside your sketch folder so that it will be included when exported as an application.

    BTW I don't think this is part of the Apache Commons Collections rather it uses an Apache License 2 to specify user rights and obligations when using this software. SO the topic title is misleading.

  • This is supposed to be a conversion .. you post question .. someone posts reply .. you post reply to reply (you don't just modify the original question)

    From what you say you don't appear to have tried my suggestion so I find your "Rejected Answer" disappointing.


    Placed the JAR file in the Processing folder in My Documents folder and import library using the "Import Library..."

    If you put the JAR file where you said, then I am surprised that Processing could find the library, never mind adding the import statements.

    If the JAR file is called Abc.jar the it should be in a folder

    My Documents/Processing/libraries/Abc/library/Abc.jar

    replacing Abc with actual name with matching case.

Sign In or Register to comment.