Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Adding jars to a Eclipse PlugIn

I try to build a Eclipse plugin that has 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?

like image 411
ethnix Avatar asked Apr 21 '11 13:04

ethnix


People also ask

Why can't I add external JARs in Eclipse?

However, the 'add external jars' button is greyed out, implying that i am not allowed to use it. Can anyone help? If your project builds with Java 9+ make sure you've selected Classpath (as shown here). You should also be able to add the JAR with right-click on the project > Build Path > Add External Archives....

Can we import jar file in Eclipse?

Drag the jar file into the project folder in Eclipse. The jar file will now show up in the project. 2. Right click on the project after you have added the jar and select Properties.


1 Answers

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.
like image 195
ethnix Avatar answered Nov 03 '22 21:11

ethnix