I struggled alot before I got this working. In my case I want to validate a webpage, as HTML5, using a Jenkins job. I dont want to have to deploy anything to do the validation, just use a library and do it all offline.
I found Nu Validator which seems to be working great. Started looking for its implementation, its Java, great! =)
Started looking into the code, trying to figure out how to use it... It is very unclear and after some googling I found out that I'm definitly not alone with that opinion.
I came up with a great solution that I'd like to share.
There is a WAR in the release. It contains an API. Basically I am using Jetty to start a tiny webserver, deploying the WAR in it, invoking the API and stopping the server.
Check it out at GitHub!