Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Eclipse plugin development - Bundle-ClassPath definition

I am developing plugin that need to use JDBC driver (mysql-connector-java-5.1.19-bin.jar). When I define path to this jar file in plugin manifest like this:

Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar

plugin stops to recognize my view and i get this exception:

java.lang.ClassNotFoundException: diplomaproject.views.SampleView
    at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:494)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:410)
    at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:398)
    at org.eclipse.osgi.internal.baseadaptor.DefaultClassLoader.loadClass(DefaultClassLoader.java:105)
    at java.lang.ClassLoader.loadClass(Unknown Source)
    at org.eclipse.osgi.internal.loader.BundleLoader.loadClass(BundleLoader.java:326)
    at org.eclipse.osgi.framework.internal.core.BundleHost.loadClass(BundleHost.java:231)
    at org.eclipse.osgi.framework.internal.core.AbstractBundle.loadClass(AbstractBundle.java:1193)
...

When i delete line:

Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar

from manifest, view is working but JDBC connector does not work.

My whole manifest file:

Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: DiplomaProject
Bundle-SymbolicName: diplomaProject; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: diplomaproject.Activator
Bundle-Vendor: MYDIPLOMA
Require-Bundle: org.eclipse.ui,
 org.eclipse.core.runtime
Bundle-RequiredExecutionEnvironment: JavaSE-1.6
Bundle-ActivationPolicy: lazy
Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar
like image 610
dulo Avatar asked Jan 16 '23 22:01

dulo


2 Answers

You have to add a dot ('.') to the bundle class path. This adds all classes compiled from the sources contained in your plug-in to the class path.

The correct property in the manifest should be:

Bundle-ClassPath: lib/mysql-connector-java-5.1.19-bin.jar,
 .
like image 109
Tillmann Seidel Avatar answered Feb 11 '23 14:02

Tillmann Seidel


You need to add the bundle to the classpath as well. Try this:

Bundle-ClassPath: .,lib/mysql-connector-java-5.1.19-bin.jar
like image 31
brindy Avatar answered Feb 11 '23 14:02

brindy