开发者

Adding jars to a Eclipse PlugIn

开发者 https://www.devze.com 2023-02-28 10:01 出处:网络
I try to build a Eclipse plugin that ha开发者_如何学Cs to use a self written jar which is dependent on other jars, but I don\'t get the point where to start with handling jars as seperate PlugIns. Any

I try to build a Eclipse plugin that ha开发者_如何学Cs to use a self written jar which is dependent on other jars, but I don't get the point where to start with handling jars as seperate PlugIns. Anywhere I have to use just the .jar files or am I wrong?


I think I found a proper solution; the trick is that you have to implement all the files via Eclipse. I just copy here the solution which was posted to news.eclipse.platform:


Include the jars in a plugin:


  1. Use Import > File System to import the jar files into your plugin project, say in the <project>/lib directory.
  2. Use Add... button to add the jars to the classpath section of the plugin.xml > Runtime tab.
  3. Use New... button to add "." library back (with no quotes, of course).
  4. Make sure your binary build exports the new jar files on the plugin.xml > Build tab.
  5. Save
  6. On the project, use context menu > PDE Tools > Update Classpath to correctly add the jars to the eclipse project classpath.


What is a self-written jar?

Normally you turn 3rd party jars into bundles using an OSGi MANIFEST.MF (See New>Plug-in Development>Plug-in from Existing JAR archive) or you include them in your plugin.jar and add extra Bundle-ClassPath entries as mentioned by TomaC.

If you mean at runtime your plugin will create a new jar and needs to load it, that's different, though.


Project Properties -> Java Build Path -> Add External jars. Is this what you are looking for?

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号