jkteater
jkteater

Reputation: 1391

Eclipse - Adding a Jar File to a existing Project

I am running Eclipse 3.7. I am currently working on a Plug-In Project for a Application called Team Center. I was recently made aware of a jar file of SWT Widgets named Opal. So I am trying to figure out how to add the Jar File to my existing project. I have tried many different ways to do this. Nothing has worked so far.

Here are some of the things I have tried.

  1. Made a lib directory in my current project copied the jar file
  2. Build Path Configure -> Libraries -> Added the Jar
  3. Runtime tab -> Add -> selected the lib/jar file -> update build path
  4. Saved
  5. My project still compiles, but at runtime it fails and I get can't load proxied handler errors

I have tried to create a plugin project just for the Jar File, then add the opal plugin to required Plug-ins. If the Opal project is closed, that reflects with the Opal plugin in my project.

Here is the way my current project works. It is a plug-in project and when I finish or change code.

  1. Build Project
  2. Export
  3. Deployable plug-ins and fragments
  4. Select my project plug-in
  5. Finish
  6. Then I copy the project.jar to the TeamCenter Application plug-ins directory

I am assuming that somehow I have to include the opal.jar in the project.jar. But right now I am at a total lost on how to do it.

Upvotes: 2

Views: 4811

Answers (2)

christian.vogel
christian.vogel

Reputation: 2137

In Eclipse Plugin Project click on your MANIFEST.MF file and go to the runtime tab. There should be a section "Classpath". Try to add your lib there.

UPDATE

I've tried it and it has worked for me. I've executed following steps:

  1. create new Plug-In project
  2. create new lib folder in it
  3. copy opal lib to the folder
  4. open the MANIFEST.MF, go to the Runtime tab and add the lib to the Classpath section
  5. check whether the lib folder is recognized of the build process (Build tab and lib folder should be checked)
  6. Create new Run Configuration (Run -> Run Configuration... -> double click on OSGi Framework)
  7. on Bundles tab check the new made project (Workspace section) and uncheck Target Platform for now
  8. mark the new project and click on the button Add Required Bundles on the right side
  9. now some needed bundles to run your project should be checked in the Target Platform section
  10. click Apply, then Run and your OSGi env will be started

Upvotes: 3

sambi reddy
sambi reddy

Reputation: 3085

check build.properties in your plugin. check lib folder should be included there.

open plugin.xml or MANIFEST.MF in editor, you see build Tab. In the binary build, make sure your lib folder is checked.

Upvotes: 1

Related Questions