I tried to compile this simple code, but I have a compilation error.
- Code: Select all
import org.docx4j.openpackaging.packages.WordprocessingMLPackage;
public class CreateWordprocessingMLDocument {
public static void main(String[] args) throws Exception {
WordprocessingMLPackage wordMLPackage = WordprocessingMLPackage.createPackage();
}
}
Eclipse gives me:
- Code: Select all
Creating package..
08.09.2010 08:57:03 *DEBUG* PartName: Trying to create part name / (PartName.java, line 150)
08.09.2010 08:57:03 *DEBUG* PartName: /_rels/.rels part name created. (PartName.java, line 117)
08.09.2010 08:57:03 *DEBUG* PartName: /docProps/core.xml part name created. (PartName.java, line 117)
08.09.2010 08:57:03 *DEBUG* PartName: / part name created. (PartName.java, line 117)
08.09.2010 08:57:03 *DEBUG* PartName: / part name created. (PartName.java, line 170)
Exception in thread "main" java.lang.NoClassDefFoundError: org/jvnet/jaxb2_commons/ppp/Child
at java.lang.ClassLoader.defineClass1(Native Method)
at java.lang.ClassLoader.defineClassCond(Unknown Source)
at java.lang.ClassLoader.defineClass(Unknown Source)
at java.security.SecureClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.defineClass(Unknown Source)
at java.net.URLClassLoader.access$000(Unknown Source)
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at org.docx4j.openpackaging.packages.WordprocessingMLPackage.createPackage(WordprocessingMLPackage.java:382)
at CreateWordprocessingMLDocument.main(CreateWordprocessingMLDocument.java:14)
Caused by: java.lang.ClassNotFoundException: org.jvnet.jaxb2_commons.ppp.Child
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
... 14 more
For Docx4j installation, I followed this guide
http://dev.plutext.org/svn/docx4j/trunk ... arted.html
I use:
- jdk-6u20
- docx4j-2.5.0.jar (I tried also with the nightly build, I have the same error message)
- log4j-1.2.15.jar
The OS is windows XP SP3 and Eclipse is “Helios” build id: 20100617-1415.
For log4j I use a « log4.properties » file.
I search on google for « java.lang.NoClassDefFoundError ». I found lots of topics but I didn’t understand how to apply them to Docx4j.
Maybe I only miss a step in the "GettingStarted" tutorial.
Thanks for your help.