Peter Leugner reminded me of the best method for including Java Packages that come with the Notes install and, for those who have never done it before, here is a pictorial description.

From the Package Explorer you have access to the plugin.xml. As well as an XML editor this also has GUI tabs, one of which is Dependencies. Just click on the Add button and you get a dialog of all libraries available. Note the library has a version number against it – we’ll come back to that.

 Adding Libraries

Now go to the plugin.xml tab. It should look like this.

 Plugin.xml XML Editor Before

 

There are two things we need to do. First is to move it outside the AUTOGEN block, or it will get removed when the Build process runs. The second is remove the version attribute, so it will not look for a specific version number, so will work on a PC with a different Designer version. The final code should look like this:

Plugin.xml XML Editor After 

Of course that code is straightforward, especially when you’ve got the other plugins above as an example. So the next time, if you know the package you want to include, it’s probably easier to just use the XML editor on the plugin.xml tab.

3 thoughts on “How to Add In-Built Java Packages”

  1. Hi Paul,

    I’m trying to include Apache Commons library in my app to use the WordUtils class. I have followed the steps above but get an error 500. On checking the error-log-0.xml file I can see that the real error is a NoClassDefFoundError. Is there anything additional to the steps above that I need to do to gain access to the classes in the JAR?

    Thanks
    Martin

  2. I’ve hit big problems with this myself and struggled tracking everything down. It worked fine on one 8.5.2 server, but threw the errors you’re seeing on another and also on 8.5.3. Philip Riand queried whether the file was available just at compile time, not at run time. I tried adding the file as a plugin on the server, but that didn’t work. I THINK the Apache commons file tries logging, which throws errors that don’t get shown anywhere.

    I managed to get it working recently but haven’t tested it.

    Create a folder under WebContentWEB-INF called lib. You don’t need to add it into the Build Path. Import the apache commons jar into that as a jar. Then it worked for me, but as I say I haven’t tested on more than one method on one server.

  3. Thanks, Paul – that has worked for me, at least testing locally. I need to replicate up to the server and check it’s ok there too, but it’s looking more promising.

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.