java.lang.NoClassDefFoundError: org/w3c/tidy/Tidy , Maven project

I am trying to run java application built in Maven 2 from command prompt

On command prompt I did "mvn package" and got the jar in target folder of the application

Then I did:-

java -cp target/TempestApp.jar foo.App

And I get exception:-

Exception in thread "main" java.lang.NoclassDefFoundError: org/w3c/tidy/Tidy
      at foo.htmltoxml.HtmlToXMLConvertor(

The application comprises of a JTidy. Who's dependency is mention in the POM.xml

Application runs fine in Eclipse but not from command prompt.

I even tried putting the JTidy jar in classpath variable


You can let maven start your application with all the jars in the classpath. It is quite easy with the exec-maven-plugin.

Add this into your pom.xml:


Then when you want to build and execute in the same command:

mvn package exec:java

And if you just want to run the application:

mvn exec:java