I'm working on a EMF project where I've created a ecore model from a mdl file. I created the corresponding gencore file and generated the code from the gencore file. While EMF has a own serialization mechanism based on XMI I want to support my project with a own serializiation mechanism.
So far, I've done the necessary steps and if I use the debugger the corresponding methods are called. In order to read and write a file representation of my model I want to use an external library. I've done the following steps
- Created a directory lib/ in my plugin project where I've put the external library
- Added the library to the build path of the project
- Added the directory to the bundle-classpath (Manifest.mf)
- Added the directory to the bin.includes of the build.properties
If I try to run my code I get a NoClassDefFoundError exception and I don't know why. I've created a run configuration where I'm starting the project as a eclipse application. So somebody has an idea what I'm missing?
Thanks in advance!
Edit: Below my Manifest.mf file
Manifest-Version: 1.0 Bundle-ManifestVersion: 2 Bundle-Name: de.hs_rm.cs.vs.dsm.OWL Bundle-SymbolicName: de.hs_rm.cs.vs.dsm.owl;singleton:=true Bundle-Version: 1.0.0 Bundle-ClassPath: lib/, . Bundle-Localization: plugin Bundle-RequiredExecutionEnvironment: JavaSE-1.6 Export-Package: owl, owl.impl, owl.util, rdfs, rdfs.impl, rdfs.util Require-Bundle: org.eclipse.core.runtime, org.eclipse.emf.ecore;visibility:=reexport Bundle-ActivationPolicy: lazy
and also my build.properties
bin.includes = .,\ model/,\ META-INF/,\ plugin.xml,\ plugin.properties,\ lib/ jars.compile.order = lib/,\ . source.. = src/ output.. = bin/ source.lib/ = lib/ jars.extra.classpath = lib/owlapi-bin.jar
it's not really a hundred percent solution since I'm not aware what exactly the problem was at all. I've found a link where somebody had the exactly same problem (added a jar as library, NoClassDefFoundError exception during execution). So far, the necessary steps are:
- Import JARs using the "Import -> File System"
- Add the JAR-file(s) to the classpath section of the Manifest/plugin.xml runtime tab
- Press "New..." to add "." library back to the classpath
- Check that the binary build exports the new JAR-file(s) on the Build tab
- Press save
- Select the coressponding project in the project explorer view, right click and select "PDE Tools -> Update classpath". This will add the newly added JAR-file(s) to the project's classpath.
I've had some trouble with the last step since I've added the library by myself to the build path of the project. Every time I did this eclipse removed the library from the build path while executing the "Update classpath command". I've repeated step six without adding the library to the build path by myself and it's now working.
It seems a bit odd to me, but it's now working. Anyway I would like to thank you for your help!