Issue
I want to check internal web pages, so I cannot use the W3C validation service directly. I managed to run the XHTML validator locally, however, I have some problems with the css-validator. I do not really want to setup Tomcat or Jigsaw in order to be able to run Java servlet, and the commandline option gives me an error message
Exception in thread "main" java.lang.NoClassDefFoundError:
org.w3c.tools.resources.ProtocolException at
org.w3c.css.css.CssValidator.main(CssValidator.java:164)
How can I validate local CSS on a Linux box?
Solution
You can invoke the W3C validator from the command line:
Command-Line use
Any computer with Java installed can also run the validator from the terminal/console as a commandline tool. Download the css-validator.jar jar archive (or build it with ant jar) and run it as :
java -jar css-validator.jar http://www.w3.org/
Note : the
css-validator.jar
file must be located at the exact same level as the lib/ folder to work properly.
Update: To get it to work, I checked out the full distribution from CVS and ran ant
using the included build.xml
. It downloaded all dependencies except for servlet.jar
. To deal with that, I downloaded the binary distribution of Tomcat 6 and extracted it. Then, I edited the build.xml
for css-validator
to reflect the location of servlet.lib
:
<property name="servlet.lib"
value="E:/Downloads/apache-tomcat-6.0.20/lib/servlet-api.jar"/>
Then ran ant
again. This produced the css-validator.jar
file in the top level of the directory checked out from CVS with the lib
subdirectory containing the other jar
s it depends on. Then, I was able to run the validator successfully:
C:\Temp\validator\2002\css-validator> java -jar css-validator.jar http://www.unur.com/
Answered By - Sinan Ünür Answer Checked By - Gilberto Lyons (WPSolving Admin)