Reputation: 9244
Firstly, I have tried the method given in official page of eclipse . But I really do not get my gson jar working, the error is still : Class not found.
This is my manifest.fm :
Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: Eclipseplugin
Bundle-SymbolicName: com.snipplr.eclipseplugin; singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Activator: com.snipplr.eclipseplugin.Activator
Bundle-Vendor: SNIPPLR
Require-Bundle: org.eclipse.ui,
org.eclipse.core.runtime,
org.eclipse.core.resources,
org.eclipse.jface.text;bundle-version="3.7.1",
org.eclipse.ui.editors;bundle-version="3.7.0"
Bundle-RequiredExecutionEnvironment: JavaSE-1.7
Bundle-ActivationPolicy: lazy
Export-Package: com.google.gson
Bundle-ClassPath: library.jar,
.
Import-Package: com.google.gson
I just declare a simple gson as : Gson gson = new Gson();
My question is:
What's wrong in my doing ?
After the success following Francis answer, I have another question. Can I simplify the steps to how to include 3rd jar :
Does it work ?
If you need any information, just ask in comment. I will watch this all day till it's done :P . Thanks
Upvotes: 0
Views: 831
Reputation: 19443
Your Bundle-Classpath needs to have gson.jar in it. You can do this in the manifest file directly, or on the Runtime tab add it to the classpath part with the GUI.
To answer your further questions:
Well step 2 would be to include your gson.jar file. I don't know what's in library.jar. As I said above you can do that through the GUI by using the classpath portion of the Runtime tab in the manifest editor. Adding it to the classpath there will also add it to your Java build classpath.
You also don't need to have the Export-Package for com.google.json if you are just using it in your plugin, the purpose of Export-Package is to provide it to another plugin that might use your plugin.
Upvotes: 4