Install docx4j
(Note: this page last checked 20 May 2008)
Command line - Quick Instructions
Create a directory called workspace, and cd into it.
svn co http://dev.plutext.org/svn/docx4j/trunk/docx4j docx4j
open pom.xml, find the line which reads
<systemPath>/usr/lib/jvm/java-6-sun/jre/lib/rt.jar</systemPath>
and edit it to suit your system.
export MAVEN_OPTS=-Xmx512m
mvn install -Dmaven.test.skip=true
That will install the dependencies and all being well, create a jar.
Once the dependencies are installed, you can also build docx4j using ant:
ANT_OPTS="-Xmx512m -XX:MaxPermSize=256m" ant dist
That ant command will create the docx4j.jar and place it and all its dependencies in the dist dir.
Eclipse
These detailed instructions are for Eclipse. If you use a different IDE, you will have to follow your nose. Please take note of your steps, and post here.
Prerequisites
- Java 1.5 or 6
- Download and install Eclipse.
- Install an Eclipse subversion plugin eg http://subclipse.tigris.org/update_1.2.x
- Install Maven and the Eclipse plugin
- JAXB (unless you are using JDK 1.6, which we recommend)
Instructions
- File > New "Project .." > SVN > Checkout Projects from SVN
- Create a new repository location; Url is http://dev.plutext.org/svn/docx4j
- Click folder "trunk", and select docx4j; click next
- You want to check it out as a project configured using the New Project Wizard
- Then select Java > Java Project; click Next
- Choose a project name (eg docx4j) then click Next
- Click Finish (we'll define the Java build settings in a later step)
After a couple of other dialog boxes, you should have the new project in your workspace.
Now, we need to configure the class path etc within Eclipse so that it can build.
- Build Path > Configure Build Path > Java Build Path > Source tab
Click on src, then press the remove button
Then click "add folder" and navigate through to src/main/java and tick 'java'
Then add src/diffx as well
- Make sure you have Maven and its plugin installed - see Prerequisites above. Run mvn install in the docx4j dir from a command prompt (just in case)
- Right click on project > Maven 2 > Enable
The project should now be working in Eclipse without errors. If you get the error 'Access restriction: The type is not accessible due to restriction on required library rt.jar' (perhaps using some combination of Eclipse 3.4 and/or JDK 6 update 10?), you need to go into the Build Path for the project, Libraries tab, select the JRE System Library, and add an access rule, "Accessible, ". If you want to run any of the main methods in docx4j, you'll want to configure log4j.
Problems?
Please post to the docx4j forum.
