问题描述
正如你所见:
我向我引用的库添加了 jni4net.j-0.8.6.0.jar
,但是我收到一个 java.lang.NoClassDefFoundError
异常:
I added jni4net.j-0.8.6.0.jar
to my referenced libraries but I stell receive a java.lang.NoClassDefFoundError
Exception:
java.lang.NoClassDefFoundError: net/sf/jni4net/Bridge
at sibeclipseplugin.debug.DebuggerInterface.initialize(DebuggerInterface.java:15)
at sibeclipseplugin.debug.SibDebugTarget.<init>(SibDebugTarget.java:65)
at sibeclipseplugin.ui.launch.LaunchConfigurationDelegate.launch(LaunchConfigurationDelegate.java:30)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:858)
at org.eclipse.debug.internal.core.LaunchConfiguration.launch(LaunchConfiguration.java:707)
at org.eclipse.debug.internal.ui.DebugUIPlugin.buildAndLaunch(DebugUIPlugin.java:1018)
at org.eclipse.debug.internal.ui.DebugUIPlugin$8.run(DebugUIPlugin.java:1222)
at org.eclipse.core.internal.jobs.Worker.run(Worker.java:53)
Caused by: java.lang.ClassNotFoundException: net.sf.jni4net.Bridge cannot be found by SIBEclipsePlugin_0.0.0.1
at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:501)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:421)
at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:412)
at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:107)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 8 more
我不知道问题是什么。当我启动项目作为Eclipse-Application它找不到该类。在正常的Java-Project中运行相同的代码。
I have no idea what the problem is. When I start the project as Eclipse-Application it can't find that class. Running the same code in a normal Java-Project works.
有没有人知道如何解决这个问题?
Does anybody know how to fix this?
推荐答案
在您的build.properties bin.includes条目中添加jar文件。此外,在您的MANIFEST.MF文件中,需要在Runtime-> Classpath列表中添加(对应于MANIFEST.MF中的Bundle-ClassPath条目)。
You need to add the jar files in your build.properties bin.includes entry. Also, in your MANIFEST.MF file, they need to be added in the Runtime->Classpath list (corresponds to the Bundle-ClassPath entry in the MANIFEST.MF).
编辑:如果你把它们放在引用的库中,OSGi系统就不会知道这个事实。
if you just put them in the referenced libraries, the OSGi system will not be aware of that fact.
这篇关于Eclipse插件:java.lang.NoClassDefFoundError的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!