I am new to JAXB and I want Marshal and un-marshal XML / Objects to Objects / XML.
I have downloaded JWSDP 2.0 from (costs 22.69 MB) the Sun website.
I set the environment variables as
JAVA_HOME :- D:\Program Files\Java\jdk1.5.0
JWSDP_HOME :- D:\Sun\jwsdp-2.0
JAXB_HOME :- D:\Sun\jwsdp-2.0\jaxb
PATH :- D:\Program Files\Java\jdk1.5.0\bin;D:\Sun\jwsdp-2.0\jwsdp-shared\bin;
I am trying to compile a simple XSD file (named tp.xsd) using XJC (which is present in D:\Sun\jwsdp-2.0\jaxb\bin).
I get the following output when I try to compile it:
D: \ Sun \ jwsdp-2.0 \ jaxb \ bin> xjc tp.xsd
parsing a schema...
compiling a schema...
generated\Bookdata.java
Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Class.getSimpl
eName()Ljava/lang/String;
at com.sun.codemodel.JCodeModel$JReferencedClass.name(JCodeModel.java:54
5)
at com.sun.codemodel.JFormatter.t(JFormatter.java:283)
at com.sun.codemodel.JClass.generate(JClass.java:358)
at com.sun.codemodel.JFormatter.g(JFormatter.java:346)
at com.sun.codemodel.JAnnotationUse.generate(JAnnotationUse.java:388)
at com.sun.codemodel.JFormatter.g(JFormatter.java:346)
at com.sun.codemodel.JDefinedClass.declare(JDefinedClass.java:767)
at com.sun.codemodel.JFormatter.d(JFormatter.java:372)
at com.sun.codemodel.JFormatter.write(JFormatter.java:402)
at com.sun.codemodel.JPackage.build(JPackage.java:434)
at com.sun.codemodel.JCodeModel.build(JCodeModel.java:297)
at com.sun.codemodel.JCodeModel.build(JCodeModel.java:287)
at com.sun.tools.xjc.Driver.run(Driver.java:378)
at com.sun.tools.xjc.Driver.run(Driver.java:196)
at com.sun.tools.xjc.Driver._main(Driver.java:121)
at com.sun.tools.xjc.Driver.access$000(Driver.java:79)
at com.sun.tools.xjc.Driver$1.run(Driver.java:101)
Can you help me find a solution? I know the mistake
Exception in thread "main" java.lang.NoSuchMethodError: java.lang.Class.getSimpl eName()Ljava/lang/String;
is due to incompatibility between the compiler and the class, but I don’t understand what to do!
When I run the java -version command, it shows:
C:\Documents and Settings\welcome>java -version
java version "1.6.0_23"
Java(TM) SE Runtime Environment (build 1.6.0_23-b05)
Java HotSpot(TM) Client VM (build 19.0-b09, mixed mode, sharing)
Kunal source
share