Re: css-validator.jar build problem

Andrei Doicin wrote:
> Well it was nice job finally building the css-validator.jar [and btw I
> had to throw apache-commons-lang.jar into the prereq mix also], but the
> thing still doesn't work.
> 
> In fact, it gives exactly the same result when you use the binary
> css-validator.jar (I tried that a few days ago too ;) download linked on
> the install page, as when you use the jar you build with ant.
> 
> From the command line: 
> 
> [root@io-dev23 opt]# java -jar css-validator.jar http://www.w3.org/
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/w3c/tools/resources/ProtocolException
> Caused by: java.lang.ClassNotFoundException:
> org.w3c.tools.resources.ProtocolException
>         at java.net.URLClassLoader$1.run(URLClassLoader.java:200)
>         at java.security.AccessController.doPrivileged(Native Method)
>         at java.net.URLClassLoader.findClass(URLClassLoader.java:188)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:307)
>         at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
>         at java.lang.ClassLoader.loadClass(ClassLoader.java:252)
>         at java.lang.ClassLoader.loadClassInternal(ClassLoader.java:320)
> Could not find the main class: org.w3c.css.css.CssValidator. Program
> will exit.

Yes, you cannot use java -jar because then you miss all the dependencies.
Here is an old validator.bat, I don't use anymore so I'm not sure it 
works; but you get the idea: build the classpath with the jars in 
WEB-INF/lib, it should not use container provided dependencies.


set CLASSPATH=WEB-INF\lib\commons-collections-3.1.jar
set CLASSPATH=%CLASSPATH%;WEB-INF\lib\commons-lang-2.4.jar
set CLASSPATH=%CLASSPATH%;WEB-INF\lib\jigsaw.jar
set CLASSPATH=%CLASSPATH%;WEB-INF\lib\tagsoup-1.2.jar
set CLASSPATH=%CLASSPATH%;WEB-INF\lib\velocity-1.5.jar
set CLASSPATH=%CLASSPATH%;WEB-INF\lib\xercesImpl.jar
set CLASSPATH=%CLASSPATH%;WEB-INF\lib\xml-apis.jar

set PACKAGE=org.w3c.css.css

java %JAVA_OPTIONS% %PACKAGE%.CssValidator %1 %2 %3 %4 %5 %6 %7 %8 %9

Alternatively you can check in my dev version the dependencies I use ( 
http://www.cynicalturtle.net/css/css-validator.jnlp ).

Damien

Received on Wednesday, 12 November 2008 20:53:16 UTC