Download and Install the CSS Validator

# CSS Validation Service

Check Cascading Style Sheets (CSS) and (X)HTML documents with style sheets

## Download and Install the CSS Validator

### Download the CSS Validator

The CSS validator is available in three different packaging: from Git for developers who want the very latest version, as a jar archive to build applications and for use as a command line tool, and (since 2009) as a war archive for server-side applications.

#### Download the source code

The source of the CSS Validator can be retrieved with Git. Please note that the online service for the CSS validator is a stable release, generally a little older than the version under Git, and their results and behaviour may differ.

#### Download the Java archive (jar)

css-validator.jar

### Installation Guide

The CSS Validation service is based on a servlet written in the cross-platform Java language, and can be installed on any servlet platform. While the official service from W3C runs under the Jigsaw server (which is the recommended setup), we will for the sake of convenience describe in this guide the setup under Apache's servlet engine, Tomcat, as well as some quick instructions for Jigsaw and commandline usage.

#### Prerequisites

This guide assumes that you have already downloaded and installed successfully the following:

- a working java environment ;
- the Ant java build tool ;
- a Java servlet container such as Jigsaw, Tomcat or Jetty, if you plan to provide the validator as a web service.

As a prerequisite to the installation, you will need to know the complete path to the java library called servlet.jar. It is generally available within [TOMCAT_DIR]/common/lib/, with [TOMCAT_DIR] being the path under which Tomcat is installed. It may also be found under the name servlet-api.jar. If you can not find it, java.sun.com will have it.

#### Installation of the CSS validator under Tomcat

1. Download the Git source as explained above ;
2. Edit the file called [VALIDATOR_DIR]build.xml and replace the value of property servlet.lib with the full path to servlet.jar
3. You can now build the source : from [VALIDATOR_DIRrun the command `ant war`. Running ant should download a number of necessary libraries, and build the archive called css-validator.war.
4. Copy or move css-validator.war to [TOMCAT_DIR]/webapps.
5. Finally, restart the Tomcat engine :
   `"cd [TOMCAT_DIR]; ./bin/shutdown.sh; ./bin/startup.sh;"`

#### Installation of the CSS validator under Jigsaw

1. Download the Git source as explained previously, save it under [JIGSAW_DIR]/WWW and build source with `ant jigsaw` ;
2. Next, configure the root folder for the validator (in most cases it will be called css-validator) to make it a servlet container. Within your Jigsaw installation, launch the Jigsaw Admin utility, browse to `css-validator` and change it from HTTPFrame to ServletDirectoryFrame ;
3. The next step will be to create a "validator" resource as 'ServletWrapper' class. A 'ServletWrapperFrame' frame will automagically be created for it. You will need to provide the name of the servlet class, which for the CSS Validator os org.w3c.css.servlet.CssValidator. Note that a file called “validator” may already be present – you MUST rename it, as the validator absolutely needs to enforce this name for the servlet wrapper ;
4. Make sure that all the .jar libraries within the [JIGSAW_DIR]/WWW/css-validator/lib folder are properly added to Jigsaw's CLASSPATH setup.
5. Finally, restart Jigsaw and point your browser to the validator. The URI should be something like :
   http://localhost:8001/css-validator/validator.html

### 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/`.

- Български
- Deutsch
- English
- Español
- Français
- 한국어
- Italiano
- Nederlands
- 日本語
- Polski
- Português
- Русский
- Svenska
- 简体中文