[英]Eclipse RCP: java.lang.ClassNotFoundException a runtime
One of my plugins uses a library (jar file). 我的一个插件使用了一个库(jar文件)。
What am I missing? 我错过了什么?
Welcome to the wonderful world of OSGi! 欢迎来到OSGi的精彩世界! :D
:d
You have two options: 您有两种选择:
You can go the OSGi way and repack your JAR in an OSGi bundle. 您可以使用OSGi方式并在OSGi包中重新打包JAR。 This is clean and recommended in the sense of OSGi, since all code should be packaged in OSGi bundles (which in you case are called Eclipse plugins ).
从OSGi的意义上讲,这是干净的并且是推荐的,因为所有代码都应该打包在OSGi包中(在你的例子中称为Eclipse插件 )。 However, this means additional work and I personally do not like it.
但是,这意味着额外的工作,我个人不喜欢它。
Put the JAR file to the root (or a folder called lib
) of your bundle and add a Bundle-ClassPath
entry to your manifest: 将JAR文件放到捆绑包的根目录(或名为
lib
的文件夹)中,并向清单中添加Bundle-ClassPath
条目:
Bundle-ClassPath: .,lib/library.jar
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.