Reputation: 21
As part of a project, I have been asked to carry out an XML to HTML transformation. I have to use Xalan Version 2.7.0.
However when I set the CLASSPATH for xalan in command prompt:
set CLASSPATH=%CLASSPATH%;I:\Xalan\xalan-j_2_7_0\xalan.jar
and try to carry out the transformation as follows:
java org.apache.xalan.xslt.Process -in Multimedia\StudentDeals.xml -xsl Multimedia\StudentDeals.xsl -out Multimedia\Deals.html
I always get this:
Exception in thread "main" java.lang.NoClassDefFoundError: org/apache/xalan/xslt
/Process
Caused by: java.lang.ClassNotFoundException: org.apache.xalan.xslt.Process
at java.net.URLClassLoader$1.run(Unknown Source)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source)
at java.lang.ClassLoader.loadClass(Unknown Source)
Could not find the main class: org.apache.xalan.xslt.Process. Program will exit
Does anyone know why I am getting this error and how to resolve it? Thanks
Upvotes: 2
Views: 7331
Reputation: 3696
Following the link that Mads Hansen provided above, I tried things out. I got it working all right, without having to specify serializer.jar in the classpath, but I did include the classpath option in the call itself:
java -classpath D:\XSLT_engines\xalan-j_2_7_1\xalan.jar org.apache.xalan.xslt.Process -in input.xml -xsl transformation.xsl -out output.xml
Upvotes: 5