无法让 Xalan 运行任何示例

发布于 2024-12-17 04:12:02 字数 1128 浏览 4 评论 0原文

我下载了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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

煮酒 2024-12-24 04:12:02

好的,这就是我最后让它工作的方法:

xalan.jar 复制到 c:\Program Files (x86)\Java\jre6\lib\
从命令行运行这样的文件:

java -classpath "c:\Program Files (x86)\Java\jre6\
lib\xalan.jar";"c:\xalan-j_2_7_1\serializer.jar" org.apache.xalan.xslt.Process -
in hello.xml -xsl hello.xsl

没有 serializer.jar 它不起作用!

Ok, this is what I did to make it work, finally:

Copy the xalan.jar to the c:\Program Files (x86)\Java\jre6\lib\
Running the file like this from command line:

java -classpath "c:\Program Files (x86)\Java\jre6\
lib\xalan.jar";"c:\xalan-j_2_7_1\serializer.jar" org.apache.xalan.xslt.Process -
in hello.xml -xsl hello.xsl

Without serializer.jar it doesn't work !

古镇旧梦 2024-12-24 04:12:02

并非在所有情况下都需要序列化器。例如,如果您的 XSLT 使用了 pipelineDocument,那么就需要它。

此错误表明未找到 xalan.jar 的“org.apache.xalan.xslt.Process”。重新检查您的类路径。排除 hello.xml 和 hello.xsl 以避免它们搅浑水。如果您的类路径正确,则仅此一项

java org.apache.xalan.xslt.Process

即可提供输出(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

java org.apache.xalan.xslt.Process

will provide output (Xalan-J command line options).

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文