This week's book giveaway is in the Reactive Progamming forum.
We're giving away four copies of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams and have Adam Davis on-line!
See this thread for details.
Win a copy of Reactive Streams in Java: Concurrency with RxJava, Reactor, and Akka Streams this week in the Reactive Progamming forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
  • Campbell Ritchie
  • Liutauras Vilda
  • Junilu Lacar
  • Jeanne Boyarsky
  • Bear Bibeault
  • Knute Snortum
  • Tim Cooke
  • Devaka Cooray
Saloon Keepers:
  • Ron McLeod
  • Stephan van Hulst
  • Tim Moores
  • Tim Holloway
  • Carey Brown
  • Piet Souris
  • Frits Walraven
  • Ganesh Patekar

Cannot use External Jars with Equinox

Posts: 5
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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!!

Why should I lose weight? They make bigger overalls. And they sure don't make overalls for tiny ads:
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!