无法让 Xalan 运行任何示例
我下载了Xalan-Java Version 2.7.1
,解压它,然后设置java的PATH
和xalan的CLASSPATH
:(
set path=%PATH%;c:\Program Files\Java\jre6\bin
set classpath=%CLASSPATH%;c:\Xalan\
我也尝试过仅为 xalan.jar、xercesImpl.jar、xml-apis.jar 设置类路径)
测试简单的 Hello World 示例(或任何其他示例)时:
java org.apache.xalan.xslt.Process -in hello.xml -xsl hello.xsl -out hello.html
我总是得到以下信息:
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
问题是什么?有人有想法吗?
谢谢。
I downloaded Xalan-Java Version 2.7.1
, unpack it, and then set the PATH
for java and CLASSPATH
for xalan:
set path=%PATH%;c:\Program Files\Java\jre6\bin
set classpath=%CLASSPATH%;c:\Xalan\
(I also tried setting the classpath only for xalan.jar, xercesImpl.jar, xml-apis.jar)
When testing a simple Hello World example (or any other example):
java org.apache.xalan.xslt.Process -in hello.xml -xsl hello.xsl -out hello.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
What is the problem ? Someone has an idee ?
Thanks.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
好的,这就是我最后让它工作的方法:
将
xalan.jar
复制到c:\Program Files (x86)\Java\jre6\lib\
从命令行运行这样的文件:
没有
serializer.jar
它不起作用!Ok, this is what I did to make it work, finally:
Copy the
xalan.jar
to thec:\Program Files (x86)\Java\jre6\lib\
Running the file like this from command line:
Without
serializer.jar
it doesn't work !并非在所有情况下都需要序列化器。例如,如果您的 XSLT 使用了 pipelineDocument,那么就需要它。
此错误表明未找到 xalan.jar 的“org.apache.xalan.xslt.Process”。重新检查您的类路径。排除 hello.xml 和 hello.xsl 以避免它们搅浑水。如果您的类路径正确,则仅此一项
即可提供输出(Xalan-J 命令行选项)。
Serializer should not be needed in all cases. For example, if you XSLT was making use of pipeDocument then it would be needed.
This error points to not finding "org.apache.xalan.xslt.Process" of xalan.jar. Recheck your classpath. Exclude hello.xml and hello.xsl to avoid them muddying the water. If your classpath is correct, this alone
will provide output (Xalan-J command line options).