XMLBeans:java.io.IOException:无法运行程序“C:\ xmlbeans \ bin \ jar”:

时间:2013-11-19 16:24:02

标签: java apache xmlbeans

我正在尝试运行XMLBeans:

scomp -compiler "C:\Program Files (x86)\Java\jdk1.6.0_37\bin\javac.exe" -cp "C:\Components\*";"C:\Components\jsr173_api.jar";"C:\xmlbeans\lib\xbean.jar";"C:\xmlbeans\lib\xbean_xpath.jar";"C:\xmlbeans\lib\jaxen-1.1-beta-2.jar;" -out S2002PDPIn.jar S2002PDPIn.xsd

下面出现错误:

java.io.IOException: Cannot run program "C:\xmlbeans\bin\jar": 
CreateProcess error=2, 
The system cannot find the file specified
        at java.lang.ProcessBuilder.start(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at java.lang.Runtime.exec(Unknown Source)
        at org.apache.xmlbeans.impl.tool.CodeGenUtil.externalJar(CodeGenUtil.java:304)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.compile(SchemaCompiler.java:841)
        at org.apache.xmlbeans.impl.tool.SchemaCompiler.main(SchemaCompiler.java:272)
Caused by: java.io.IOException: CreateProcess error=2, The system cannot find the file specified
        at java.lang.ProcessImpl.create(Native Method)
        at java.lang.ProcessImpl.<init>(Unknown Source)
        at java.lang.ProcessImpl.start(Unknown Source)
        ... 6 more
BUILD FAILED

起初我认为它正在寻找的“C:\ xmlbeans \ bin \ jar”是一个目录所以我刚刚创建了一个文件夹“jar”,但当我再次运行它时,“jar”被称为文件我得到错误的地方:

java.io.IOException: Cannot run program "C:\xmlbeans\bin\jar": 
CreateProcess error=5, Access is denied

请帮助我如何解决这个问题,以便它不会寻找“jar”文件。 我看了“scomp.cmd”,但没有一行可以做到这一点。

提前谢谢。

1 个答案:

答案 0 :(得分:0)

您只是调用了比预期更多的应用程序:

scomp -compiler "C:\Program Files (x86)\Java\jdk1.6.0_37\bin\javac.exe" -cp  "C:\Components\*";

"C:\Components\jsr173_api.jar";

"C:\xmlbeans\lib\xbean.jar";

"C:\xmlbeans\lib\xbean_xpath.jar";

"C:\xmlbeans\lib\jaxen-1.1-beta-2.jar;" -out S2002PDPIn.jar S2002PDPIn.xsd

这是因为";",您必须用一个"将完整的类路径括起来,并将值分隔为;