Page 1 of 1

Getting NoClassDefFoundError after importing with Maven

PostPosted: Sat Sep 19, 2015 4:41 am
by concubicycle
I'm trying to use docx4j in a Java project, in Eclipse, and miserably failing. I tried to get the jar, and all the dependencies, but couldn't correctly set it up.

So I decided to use Maven. I right clicked the project, and did Configure->Convert To Maven Project. I then added
Code: Select all
<dependency>
  <groupId>org.docx4j</groupId>
  <artifactId>docx4j</artifactId>
  <version>3.2.2</version>
</dependency>

to pom.xml, and did Maven->Update Project

It seemed to get the docx4j and all the dependency jars into the Maven Dependencies.

I get the exception java.lang.NoClassDefFoundError whenever I try instantiating a class that uses doc4j.

Am I missing something? How do I use this library in eclipse???

Re: Getting NoClassDefFoundError after importing with Maven

PostPosted: Mon Sep 21, 2015 12:50 pm
by jason
Things to check:

1. The eclipse "problems" tab; what does it say?

2. Right click on the project, select "build path", then "configure build path". Check all the tabs look good. In particular, the libraries tab; make sure your JRE system library is >=1.6

Re: Getting NoClassDefFoundError after importing with Maven

PostPosted: Tue Sep 22, 2015 2:16 am
by concubicycle
I'm a bit new to Eclipse. What should I set in the Build Path? I'm using JRE1.6. Not seeing any errors in the problems tab, but this project has something like 1.5k warnings. Are there any particular I should look for?