File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Other Application Frameworks and the fly likes Cannot use External Jars with Equinox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Frameworks » Other Application Frameworks
Bookmark "Cannot use External Jars with Equinox" Watch "Cannot use External Jars with Equinox" New topic

Cannot use External Jars with Equinox

Joey Kirkland

Joined: Jan 22, 2013
Posts: 5
I've since fixed this...I wasn't putting my classpath jars in the actual jar I was building. That fixed my issue.


Now that I have managed to get Equinox to work, I am running into a different problem.

I have a bunch of external jars(around 10) that I use for one of my bundles. For example, I use the commons-lang3-3.1.jar for various things. When I run my OSGi framework in Eclipse - it all works great. I just need to make sure I add them to my bundle's class path.

However, when I execute it outside of Eclipse, it throws java.lang.NoClassDefFoundError: errors. I'm not sure why this is happening.

I've done a bit of research and it seems that I have really two options:

1. Place the jar file in the root directory of my bundle (in this case, the bundle's jar file), and then make sure that the manifest file has a proper Export-Package on it.
I have tried this - and it still cannot find the jar.
2. Make a bundle of the jar file, and install that, ensuring all dependencies are resolved. THIS does NOT work for jar files. However, if I copy the actual source and use that instead of a jar file within the bundle, then it works. But I won't be able to do this for all of my jars since the source isn't present and I don't want to have to build every single external jar I use...

I'm pretty new to OSGi, and any help would be useful.

The below is from option 1:

Here is the manifest file:

The .jar file is in the root directory of this bundle. It is in included in the class path and the export...I also see it in the packages command:

I am confused as to why this doesn't work - it can be seen by the framework - my bundle just can't load it!!

I agree. Here's the link:
subject: Cannot use External Jars with Equinox
It's not a secret anymore!