Re: Packaging CSS Validator and Command line

olivier Thereaux a écrit :
> 
> 
> On Jan 9, 2007, at 18:41 , Jean-Guilhem Rouel wrote:
>> During my first internship I created a new command line appl. The main 
>> class is org.w3c.css.css.CssValidator.
>>
>> java org.w3c.css.css.CssValidator --help
>>
>> Calling java -jar css-validator.jar won't use this class but the 
>> previous appl and won't probably work. It shouldn't be too hard to 
>> adapt the build.xml to use the new class.
> 
> I did that, thanks for noticing it. Still facing the same issue with 
> NoClassDefFoundError: org/w3c/tools/resources/ProtocolException but at 
> least the main class is properly set up.

Yes, as Yves told me earlier, you need to set the classpath in the jar's 
manifest. To do that, you can try to add something like:
<manifest>
    <attribute name="Main-Class" value="org.w3c.css.css.CssValidator"/>
    <attribute name="Class-Path" value="file1.jar file2.jar"/>
</manifest>
Replacing fileN.jar with all the jars needed by the CSS Validator. After 
that, re-build css-validator.jar, copy all the libs in the same dir, and 
try again a java -jar css-validator.jar. I don't like the fact that you 
need to specify where the libs are in the manifest, but I don't know if 
there's another way to load the libs.

Another possibility would be to add css-validator.jar to the classpath, 
doing something like:
java -classpath $CLASSPATH:css-validator.jar org.w3c.css.css.CssValidator

Jean-Gui

> thank you!
> --olivier
> 

Received on Tuesday, 9 January 2007 20:34:39 UTC