简体   繁体   中英

JAXB generate java class from xsd

  1. JAXB 1.5 installed under C:\\Sun\\jwsdp-1.5
  2. J2SE 1.4.2 installed under C:\\j2sdk1.4.2_08
  3. copied sample.xsd file to C:\\Sun\\jwsdp-1.5\\jaxb\\bin
  4. went to C:\\Sun\\jwsdp-1.5\\jaxb\\bin and ran xjc.bat -p com.package sample.xsd
  5. got error message: Unrecognized option: -p Could not create the Java virtual machine.

Please help me out, thanks a lot

This page seems to indicate tha xjc.bat needs Java 1.5+ :

http://forums.sun.com/thread.jspa?threadID=5359378

The last JAXB version that is compatible with java 1.4.2 is JAXB 1.0.6 . I've never heard of a version 1.5... Where did you get it?

Edit

This error message is not generated by jaxb but by the JVM. Looks like, the jvm thinks, the '-p' parameter is a jvm parameter. Here's another page where the same error message was generated at a simple java --version call.

And another explanation for the error.

I faced the similar problem and I resolved it using the following approach. I specified Jdk1.5 as the JDK while installing jwsdp1.5. But the system had jdk1.4 also installed. So I created the following batch file:

set JAVA_HOME=D:\apps\BEA\Weblogic\jdk150_04
set ANT_HOME=H:\Sun\jwsdp-1.5\apache-ant
set JWSDP_HOME=H:\Sun\jwsdp-1.5
set PATH=%JAVA_HOME%\bin;%PATH%;
%JWSDP_HOME%\jaxb\bin\xjc -p package -dtd sample.dtd

This resolved the error. Alternatively we can remove the Jdk1.4 path in the PATH environment variable, in that case, we need to write the batch file.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM