How do I add an JAR archive to an Eclipse Plugin so that other plugins can import the Java packages in that JAR archive? I’m using Eclipse PDT for Rich Client Platform Development.

  1. By direct filesystem operations or via the Eclipse package manager, create a directory in your plugin’s directory (if you want that) and place your JAR file into that. (in Eclipse package manager, use “Import … > From filesystem” for that.)
  2. Right-click the project in package manager and select “Build Path > Configure Build Path …”.
  3. In tab “Libraries”, add the JARs to the build path.
  4. In tab “Order and export”, select the JARs to have them exported. Though this seems to be redundant when compared with the next step, both steps are necessary.
  5. Open the plugin’s manifest, and in “Runtime > Exported Packages”, add the JARs.
  6. Every plugin project that wants to import packages from the newly added JARs needs to have the hosting plugin listed in its manifest as “required plugin”.







Leave a Reply

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.