Download and Install the CSS Validator

Download the CSS Validator

Download the source

The CSS validator is available for download using CVS. Follow the instructions to access the W3C CVS public server and get 2002/css-validator. Note that the online version of the CSS Validator is generally older than the CVS version so results and appearance may vary slightly...

Download as java package (jar or war)

css-validator.jar

Installation guide

The CSS validation service is a servlet software, written in Java. It may be installed on any servlet engine, and can also be used as a simple command-line tool. The official W3C CSS Validation service is running with the Jigsaw server, which is the recommended setup. However, for the sake of simplicity, we will, in this document, mostly provide details on how to install it as an online servlet with Apache's servlet engine Tomcat.

Some instructions on installing the servlet with Jigsaw, as well as running it from a command-line environment, are also given below.

Prerequisites

This installation guide assumes that you have downloaded, installed and tested:

For the installation of the validator onto your system, you will need to download and/or find in your system a number of java libraries:

Install the CSS Validator with Tomcat

  1. Download validator as explained above.
  2. Copy the whole source folder (".../css-validator/") to the webapps directory within your installation of Tomcat. usually, this will be [TOMCAT_DIR]/webapps/. The Validator's sources are now in [TOMCAT_DIR]/webapps/css-validator, which we will now call [VALIDATOR_DIR].
  3. In "[VALIDATOR_DIR]" create a directory "WEB-INF", and In "[VALIDATOR_DIR]/WEB-INF" create a directory "lib":
    mkdir -p WEB-INF/lib
  4. Copy all the jar files (from the prerequisites) to the directory "[VALIDATOR_DIR]/WEB-INF/lib"
  5. Compile the validator's source: from the directory [VALIDATOR_DIR], Run ant, while making sure that the jar files you downloaded are correctly set in you CLASSPATH environment variable. Generally, the following will just work:
    CLASSPATH=.:./WEB-INF/lib:$CLASSPATH ant
  6. Copy or move "[VALIDATOR_DIR]/css-validator.jar" to "[VALIDATOR_DIR]/WEB-INF/lib/".
  7. Copy or move file "web.xml" from "[VALIDATOR_DIR]/" to "[VALIDATOR_DIR]/WEB-INF/".
  8. Finally, reload the Tomcat server:
    "cd [TOMCAT_DIR]; ./bin/shutdown.sh; ./bin/startup.sh;"

Install on Jigsaw Web Server

  1. First, download the source as described above, get the necessary jars, and build the source with ant.
  2. Then you have to configure the validator home directory (usually this is css-validator) so that it can work as a servlet container. For this purpose you need to have Jigsaw installed (see the Jigsaw pages for a short instruction (it is really easy)) and then start Jigsaw Admin. Change the HTTPFrame to ServletDirectoryFrame.
  3. The next step is to create a resource "validator", with as class 'ServletWrapper' and as frame 'ServletWrapperFrame'. The latter should add itself automagically. The class of the servlet is org.w3c.css.servlet.CssValidator. If there already exists a file named 'validator', please rename it. It is important that this 'alias' is always named 'validator'.
  4. Finally, start Jigsaw and run the validator. Check which HTML you want to invoke. Usually your URL will look like this:
    http://localhost:8001/css-validator/validator.html

Command-line usage

The CSS validator can also be used as a command-line tool, if your computer has java installed. build the css-validator.jar as explained above, and run as:
java -jar css-validator.jar http://www.w3.org/