John,

The produced JAR-file only contains the translet class(es) and any
auxiliary classes. You still need to initiate the transformation
through the main() method in org.apache.xalan.xsltc.cmdline.Transform
or in your own similar class. A translet class does not have a main()
method and cannot be run directly from the command line.

Morten


John Howard wrote:
> 
> Hi all,
> 
> Is anyone else compiling and packaging translets to jars using
> cmdline.Compile? Can you then instance your translets?
> 
> 1. When I try:
> 
> java org.apache.xalan.xsltc.cmdline.Compile -j bar.jar -p com.schemasoft -o
> Foo Foo.xsl
> java -classpath bar.jar com.schemasoft.Foo
> 
> I get:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> com/schemasoft/Foo
> 
> 2. Whereas when I try:
> 
> java org.apache.xalan.xsltc.cmdline.Compile -j bar.jar -o Foo Foo.xsl
> java -classpath bar.jar Foo
> 
> I get (indicating the packaging seems to work):
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/xalan/xsltc/runtime/AbstractTranslet
> 
> 3. For giggles I tried:
> 
> java org.apache.xalan.xsltc.cmdline.Compile -p com.schemasoft -o Foo Foo.xsl
> jar cf baz.jar com\
> java -classpath baz.jar com.schemasoft.Foo
> 
> And I get the healthy:
> 
> Exception in thread "main" java.lang.NoClassDefFoundError:
> org/apache/xalan/xsltc/runtime/AbstractTranslet
> 
> When I compare the jars produced from 2 and 3, the only thing different is
> the manifest. XSLTC builds the manifest properly (Foo.class has an entry)
> whereas the jar tool only writes header information.
> 
> thanks,
> 
> john

Reply via email to