Search Mailing List Archives
[protege-discussion] Plugin jar - Including dependecies
tredmond at stanford.edu
Tue Sep 6 10:51:45 PDT 2011
I am a bit confused about whether you are developing for Protege 3 or
If you are developing for Protege 3 then a plugin is given by a
directory. Sometimes this directory is distributed as a zip file.
Simply put the example.jar file in the directory with the rest of the
jars for the plugin. The edu.stanford.smi.protege.owl plugin is an
example; the directory contains many jars all of which are loaded by the
If you are developing for Protege 4 then the right approach is to put
the example.jar file somewhere in the jar file and using the
Bundle-Classpath to indicate how the jar file is to be used by the class
loader. Be warned, the java Manifest file format is very reminiscent of
the format of IBM punch cards from the 1970s (line wrap on line 72, no
comments, required newline at the end, etc) so it is not friendly. This
unfriendliness may be what you are bumping into.
An example of the Bundle-ClassPath being used in a plugin can be found
in any moderately recent org.protege.editor.owl.jar plugin from a
Protege 4 distribution. It is really a zip file so any archive program
that understands zip files will let you explore it (possibly after
changing the extension to .zip). The bundle class path line in the
manifest looks like this:
Note that the Bundle-ClassPath line is really two lines - the space that
starts the next line indicates that it is to be included with its
previous line. (Remember think IBM punch cards, 1970s :)). If you will
explore the jar file you will see that the protege-owlapi-extensions and
xmlcatalog libraries are exactly where the class path indicates. (The
ant build scripts will actually take care of this reformatting for you.)
Does this help? If you are doing Protege 4 development, you can send me
the MANIFEST and the output of
jar -tf plugin.jar
and I will let you know if anything looks amiss.
On 09/06/2011 07:45 AM, Can Kahya wrote:
> I need some help in the last step of developing a plugin:
> My plugin uses an external JAR (example.jar). If I run the plugin in
> eclipse everything works out just fine (classpath set in eclipse). Now
> I want to export the plugin as a jar:
> including the lib folder (which contains example.jar). I tried many
> different ways of what to include in the jar but nothing works. I
> thought the classpath may has to be specified in the manifest file but
> that doesnt seem to work either...
> I found some information on the web which only seems to be valid for
> protege 4 (e.g. setting bundle-classpath in manifest file
> http://protegewiki.stanford.edu/wiki/PluginAnatomy#MANIFEST.MF)), as
> eclipse complains about invalid manifest format...
> I also tried to follow the link "working with JAR and Manifest files"
> on http://protegewiki.stanford.edu/wiki/PluginManifestsAndJars
> but it is broken. I really spent some time on this problem and I wold
> greatly appreciate any help (although its a pretty basic problem). Is
> there any place I have to specify a classpath? any specific
> folder(level) I have missed, where tha JAR has to be placed?
> protege-discussion mailing list
> protege-discussion at lists.stanford.edu
> Instructions for unsubscribing: http://protege.stanford.edu/doc/faq.html#01a.03
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the protege-discussion