Creating jaxb classes from a schema

I am trying to use the Jaxb class generator in eclipse to generate jaxb classes from my schema. I get the following error:

"The class path for this project does not contain the necessary libraries to continue generating the class. Please make sure that the JAXB implementation is available in the class path.

How can I solve this problem?

+7
source share
5 answers

Be sure to include the jaxb-impl.jar in your project. You can download it, for example, here: http://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar

If you are using Maven, you can include this as a dependency, otherwise upload the file and add it as a library to your project.

If you need another version of the library, move up one directory in the link I added above, you can also find other versions.

If you want to automate the creation of a class, since you regularly change the scheme, you should automate this process, for example, through Maven.

+6
source

After much research here, I did what I did to fix this problem. Windows> Preferences> Java> Installed JREs ... be sure to include your jre in the jdk directory. I was pointing to JRE, and as soon as I changed it to JDK, it started working. Hope this helps you guys.

+10
source

Windows> Preferences> Java> Installed JREs> Execution Conditions. Select the JDK 1.8 environment, and then try to create JAXB classes.

Click the link below the link for the image.

Choose runtime

+2
source

Put tools.jar in the path to the projecct classes (where the generated code will be generated).

I found an explanation here https://bugs.eclipse.org/bugs/show_bug.cgi?id=345617 This does not work because Eclipse puts the JRE libraries in the classpath of the project. Since the xjc code is in tools.jar, you need to provide this extra step.

+1
source

Download com.springsource.com.sun.tools.xjc-2.1.7.jar

and configure the build path. This solved the warning and error for me. Hope this helps.

+1
source

All Articles