1

I'm trying to validate simple HTML file with this code:

public static void main(String[] args)
{
   String xhtml = "<html><body><p>Hello, world!</p></body></html>";
   ValidationResponse response = new ValidatorBuilder().html().validate(xhtml);
   System.out.println(response.valid());
}

And result:

Exception in thread "main" java.lang.NoClassDefFoundError: com/rexsl/test/AssertionPolicy at com.rexsl.w3c.ValidatorBuilder.(ValidatorBuilder.java:64) at HTMLValidator.main(HTMLValidator.java:10)

How to fix this?

Maroun
  • 94,125
  • 30
  • 188
  • 241
Relrin
  • 760
  • 2
  • 10
  • 28
  • This simply means that you have not included all the required Jar files in your class path. What external libraries are you using? Also mention the link to library which you are using, so that we can look that API's documentation. –  Mar 03 '13 at 10:47
  • Add jar to Build path: http://stackoverflow.com/questions/3280353/how-to-import-a-jar-in-eclipse – Michał Ziober Mar 03 '13 at 10:52

1 Answers1

1

This exception appears when JVM can't find a specific Class at runtime.

Make sure that:

  • Class is available in Java Classpath.
  • If you are running your program using JAR command, make sure Class is defined in Class-Path attribute.
Maroun
  • 94,125
  • 30
  • 188
  • 241