Thursday, 7 May 2009

ClassNotFoundException when adding jar file

Occasionally we have to use external, third-party jars in Debrief. They're normally included by copying them into a libs sub-directory, and adding them to the build path.

Normally, that seems to be enough, but occasionally, at runtime we get a ClassNotFoundException reported against the contents of the jar. So, they're visible at compile time, but not at runtime. I think that on occasion I've had to explicitly add them to the runtime config command line arguments.

I've just found a better way, however, and this may even be the correct way!
  • Open the plugin.xml for the plugin containing the lib
  • Navigate to the Runtime tab
  • Add the lib to the Classpath listing in the lower right-hand listing
And that appears to be it!

No comments:

Post a Comment