dulo
dulo

Reputation: 155

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

Upvotes: 4

Views: 5737

Answers (3)

compyutech
compyutech

Reputation: 581

I was facing the same problem. My build.properties file was changed because of some changes.

I replaced the content from the similler project and it worked.

Upvotes: 0

brindy
brindy

Reputation: 4695

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

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

Upvotes: 2

Tillmann Seidel
Tillmann Seidel

Reputation: 1042

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

Upvotes: 9

Related Questions