0

我正在尝试在命令行中运行 Jibx CodeGen 以从 xml 模式 (xsd) 文件生成 Java 源文件。但是,似乎我什至无法运行 CodeGen。我知道我应该至少提供输入 xsd 作为参数,但是 CodeGen 之前崩溃了,所以这里没关系。

java -cp "~/.m2/repository/org/jibx/jibx-tools/1.2.3/jibx-tools-1.2.3.jar" org.jibx.schema.codegen.CodeGen 

Exception in thread "main" java.lang.NoClassDefFoundError: org.jibx.schema.codegen.CodeGen
Caused by: java.lang.ClassNotFoundException: org.jibx.schema.codegen.CodeGen
at java.net.URLClassLoader.findClass(URLClassLoader.java:434)
at java.lang.ClassLoader.loadClass(ClassLoader.java:660)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:358)
at java.lang.ClassLoader.loadClass(ClassLoader.java:626)
Could not find the main class: org.jibx.schema.codegen.CodeGen.  Program will exit.

我打开了jar,似乎类包是正确的。

有任何想法吗?

4

1 回答 1

0

There are two ways to run JiBX codegen:
1. Run it as a maven plugin.
2. Run it standalone.

I highly recommend running JiBX as a maven plugin. You will find lots of documentation and examples at: http://jibx.sourceforge.net/maven-jibx-plugin/index.html

If you want to run JiBX as a stand-alone program, you will need to have all the executable jars in the same directory. You can simplify your setup by downloading the entire package from our sourceforge page at: http://sourceforge.net/projects/jibx/

于 2013-04-18T16:20:25.387 回答