score:1

Accepted answer

each eclipse plugin has its own classpath. to use additional jars in the plugin you need to include them in the plugin.

add your jars to the plugin directory. usually they are put in a 'lib' directory.

open the plugin manifest.mf editor and on the 'runtime' tab in the 'classpath' section click the 'add...' button and add your jars to the class path.

on the 'build' tab of the editor make sure the 'lib' folder is include in the binary build section.

your manifest.mf should end up with a `bundle-classpath' entry that looks something like:

bundle-classpath: .,
 lib/jogg-0.0.7.jar,
 lib/jorbis-0.0.15.jar,
 lib/vorbisspi1.0.2.jar

(here i have 3 jars in a lib folder).

the build.properties file should be something like:

bin.includes = meta-inf/,\
               .,\
               plugin.xml,\
               lib/,\
               lib/jogg-0.0.7.jar,\
               lib/jorbis-0.0.15.jar,\
               lib/vorbisspi1.0.2.jar

score:0

the best approach i've found is to create a lib directory in your eclipse project (where your view is contained). place your .jar files in said lib directory.

then using the editor on the manifest.mf, you add the .jar files to the classpath. if you wish to export the packages, you then add to the exported packages as well. manfiest.mf

depending upon what you are doing, you may wish/need to also update the build configuration. build configuration

if you examine the manifest.mf file itself, you will then see an entry for bundle-classpath. it will list your entries. here it has the standard "." for the project, a resources/ directory that we export, and a couple of .jar files.

bundle-classpath: .,
resources/,
lib/aopalliance-1.0.jar,
lib/apccore-client-2.11.8.jar,
lib/cglib-nodep-2.2.2.jar,
lib/ehcache-2.10.3.jar,
...

note that in our experience, it is also necessary to adjust the java build path from the properties of the project itself. a user commented that this step may not be necessary. we are on an older version of eclipse due to our product, so ymmv, if needed (usually compile failures are the indicator), you then need to add, via the properties context menu on the project, the .jar files to the "java build path" (you can do the same with a resources directory).

java build path

this will allow you to properly build using the .jar files.

score:0

for compile time we need to add it to the project runtime library.

for the run time you have to package the jar either in your ear/war file or load it to the application server as a app server libraries.

please let me know if you need further assistance on this.


Related Query

More Query from same tag