3

One of my plugins uses a library (jar file).

  1. I created a folder called lib in my plugin and placed the jar file into it.
  2. I configured the build path by adding the jar file with "Add JARS..".
  3. I use the classes of the jar file in the plugin and it compiles fine.
  4. I start the RCP and get a ClassNotFoundException about the classes in the jar file.

What am I missing?

2
  • 1
    Does the JAR contain src files or compiled .class files? Commented Jun 12, 2014 at 8:08
  • 1
    It contains a package with .class files and a META-INF folder for the manifest file. Commented Jun 12, 2014 at 8:11

1 Answer 1

9

Welcome to the wonderful world of OSGi! :D

You have two options:

Repack the JAR as an OSGi bundle

You can go the OSGi way and repack your JAR in an OSGi bundle. This is clean and recommended in the sense of OSGi, since all code should be packaged in OSGi bundles (which in you case are called Eclipse plugins). However, this means additional work and I personally do not like it.

Use the bundle class path

Put the JAR file to the root (or a folder called lib) of your bundle and add a Bundle-ClassPath entry to your manifest:

Bundle-ClassPath: .,lib/library.jar
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.