I often get the question "How to add a third party JAR-file to my Eclipse plugin". It is not that tricky, but neither that obvious. Two solutions has been posted on the Eclipse newslists, but it can be quite hard to find it as the sheer number of posts is overhelming.
Here is two ways of doing it:
1. Turn the JAR-file(s) into plugin(s)
This is probably the simplest solution, but maybe not always achieving the desired granularity though. "Use New" -> "Project" -> "Plug-in Development" -> "Plug-in from existing JAR Archive". That will turn the JAR-file into a single JAR-plugin. Check that all required packages are re-exported.
2. Include the JAR-file(s) in the plugin in question:
Use the "Import" -> "File System" to import the JAR-file(s) into your plugin project. E.g. '/lib' directory
Then use "Add..." to add the JAR-file(s) to the classpath section of the Manifest/plugin.xml runtime tab.
Press "New..." to add "." library back to the the classpath (without quotes).
Check that the binary build exports the new JAR-file(s) on the Build tab.
Press save, important for the changes to come through.
Select the project in question in the package explorer view, right click and select "PDE Tools" -> "Update classpath". This will add the newly added JAR-file(s) to the project´s classpath.
When you are in the process of exporting the plugin make shure you do not package the plugin as "individual JAR archives", Eclipse cannot load JARs from within JARs, yet.
<?xml version="1.0" encoding="UTF-8"?>
<?eclipse version="3.0"?>
<plugin
id="colimas_plugin"
name="Colimas_plugin Plug-in"
version="1.0.0"
provider-name="nova"
class="colimas_plugin.Colimas_pluginPlugin">
<runtime>
<library name="colimas_plugin.jar">
<export name="*"/>
</library>
<library name="lib/activation.jar">
<export name="*"/>
</library>
<library name="lib/axis.jar">
<export name="*"/>
</library>
<library name="lib/commons-beanutils.jar">
<export name="*"/>
</library>
<library name="lib/commons-discovery-0.2.jar">
<export name="*"/>
</library>
<library name="lib/commons-logging-1.0.4.jar">
<export name="*"/>
</library>
<library name="lib/jaxrpc.jar">
<export name="*"/>
</library>
<library name="lib/xalan.jar">
<export name="*"/>
</library>
<library name="lib/xerces.jar">
<export name="*"/>
</library>
<library name="lib/saaj.jar">
<export name="*"/>
</library>
<library name="lib/mail.jar">
<export name="*"/>
</library>
</runtime>
<requires>
<import plugin="org.eclipse.ui"/>
<import plugin="org.eclipse.core.runtime"/>
</requires>
<extension
point="org.eclipse.ui.actionSets">
<actionSet
label="Sample Action Set"
visible="true"
id="colimas_plugin.actionSet">
<menu
label="Sample &Menu"
id="sampleMenu">
<separator
name="sampleGroup">
</separator>
</menu>
<action
label="&Sample Action"
icon="icons/sample.gif"
class="colimas_plugin.actions.SampleAction"
tooltip="Hello, Eclipse world"
menubarPath="sampleMenu/sampleGroup"
toolbarPath="sampleGroup"
id="colimas_plugin.actions.SampleAction">
</action>
</actionSet>
</extension>
</plugin>
以上是本人转载的他人的文章,最后发现根本不需要上述操作,上述操作根据没用
具体方法参见附件中的PDF文档。很详细
分享到:
相关推荐
eclipse本身不能导出第三方jar包,以上为用eclipse导出第三方jar包的插件fatjar
1.将net.sf.jadclipse_3.3.0.jar拷贝到eclipse的plugins目录下 2.再删除eclipse的configuration目录下org.eclipse.update文件 3.重启eclipse,点击菜单栏中File->Restart 4.下载jad的可执行文件,解压后放在某一磁盘...
eclipse 第三方jar包配置.txt ,不使用eclipse自带的buildpath功能!
在ECLIPSE下,如果要将JAVA应用程序打包的话,一般用file菜单下的EXPORT就可以EXPORT成JAR文件里,但如果工程里有其他的库文件的话,那ECLIPSE就无能为力了.
三个Eclipse插件可以去掉多余的java项目中jar包,有操作图示。
当运行引用了第三方jar包项目时,突然报出了jar包中的某个类的某一行出现异常。我们想看一下这个class文件的代码时,经常出现无法查看的情景,可使用JadClipse + net.sf.jadclipse_3.3.0.jar对jar包进行反编译,具体...
fatjar是一个打包包含第三方jar包的Eclipe插件。 解压后、将其中的jar包放入....\eclipse\plugins目录下,重启Eclipse, 右键项目 点击“Build fat jar”
这个是我在用eclipse引入hadoop2.2源代码后,所使用的第三方jar包
eclipse查看jar包源码工具:在Eclipse查看开发包jar源码的方法如下: 1.选择项目,右键中单击【Properties】 2.【Java Build Path】-【Configure Build Path】-【Libraries】,在下面找到如:Guava-r09.jar包,...
eclipse 的jar插件,可以快速制作jar包
eclipse离线插件:compiler反编译jar包、class文件,进行debug调试。
用Eclipse的一个第三方插件fatjar生成jar文件,也是本人觉得最简单最方便的一种生成方式。先从网上下载些插件,解压后是一个plugins的文件夹,里面只有一个文件夹,我的是“net.sf.fjep.fatjar_0.0.24”将它copy到...
android 开发 第三方jar包配置文档参考
在打开的swing窗口中的第一个文本框选择org.eclipse.wst.javascript.ui_xxxxxxx.jar,在输出目录中选择您要输出的目录,如c:\ 5. 点击“generator”按钮,在c:\下找到org.eclipse.wst.javascript.ui_xxxxxxx.jar...
描述:Eclipse插件emmet的jar包 Eclipse插件emmet的jar包
Eclipse打包成JAR包读取外部JAR包和外部配置文件 Eclipse 打包 jar 外部JAR 外部配置文件
jar包 和 eclipse插件(内含spring mvc,upload,jquery,ibatis,urlrewritefilter,mysql驱动包和svn,maven,easy explore,tomcat插件)
MyEclipse和Eclipse打包包含第三方jar包的插件,内含安装说明,方便快捷使用。
lombok插件eclipse用jar包 1将lombok.jar包复制到myeclipse.ini/eclipse.ini所在文件目录2 打开myeclipse.ini/eclipse.ini,在最后添加以下代码并保存: -Xbootclasspath/a:lombok.jar -javaagent:lombok.jar