JAXB generate java class from xsd
- JAXB 1.5 installed under C:\Sun\jwsdp-1.5
- J2SE 1.4.2 installed under C:\j2sdk1.4.2_08
- copied sample.xsd file to C:\Sun\jwsdp-1.5\jaxb\bin
- went to 开发者_Go百科C:\Sun\jwsdp-1.5\jaxb\bin and ran xjc.bat -p com.package sample.xsd
- 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.
 
         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论