Search code examples
javaintellij-ideajarlibrariesbatik

How do I properly include the Batik library in my Java project?


I am trying to properly add the Batik library to my Java project. I added the unzipped binary to my lib folder:

please see here

and then tried to add the library to my project in IntelliJ through,

File >> Project Structure >> Modules >> Dependencies >> Add (+) >> JARs or directories >> [Batik directory, now in lib folder]

which led me to here.

Should I just select "jar directory", or should I let all of these "roots" be added? I can see that some of them are parts of "demo" or "test" directories, so adding them specifically seems strange.

Additionally, I noticed a "docs" directory in the Batik binary folder (please see above image). Is there any way I can add Batik's documentation (Javadoc) to my IDE? If so, how?

For reference, I am using Batik 1.7.1.


Solution

  • Answering my own question.

    1. Download batik-1.7.zip and batik-docs-1.7.zip.
    2. Extract batik-1.7.zip to your module's \lib directory.
    3. Extract batik-docs-1.7.zip to the \lib\batik-1.7\docs directory.
    4. File >> Project Structure >> Libraries >> New Project Library (+) >> Java
    5. Select the top-level .jar files in \lib\batik-1.7 AND \lib\batik-1.7\lib (unfortunately, IntelliJ does not support adding .jar files from a directory recursively)
    6. OK >> Select target module >> OK >> Name: batik-1.7
    7. Specify documentation URL (+) >> Enter documentation URL: >> [...]/lib/batik-1.7/docs/javadoc/ >> OK