Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse plugin: java.lang.NoClassDefFoundError

As you can see:

enter image description here

I added jni4net.j-0.8.6.0.jar to my referenced libraries but I still 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

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?

like image 427
Stefan Falk Avatar asked Aug 07 '13 13:08

Stefan Falk


1 Answers

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).

Edit: if you just put them in the referenced libraries, the OSGi system will not be aware of that fact.

like image 143
Tassos Bassoukos Avatar answered Sep 22 '22 12:09

Tassos Bassoukos