Reputation: 24767
I am trying to use the Jaxb classes generator in eclipse to generate jaxb classes from my schema. I receive the following error:
"The classpath for this project does not appear to contain the necessary libraries to proceed with class generation. Please insure that a JAXB implementation is available on the classpath."
How can i solve this problem?
Upvotes: 8
Views: 20211
Reputation: 54507
Make sure to include the jaxb-impl.jar
library in your project. You can download one for example from here:
https://repo1.maven.org/maven2/com/sun/xml/bind/jaxb-impl/2.2.4/jaxb-impl-2.2.4.jar
If you're using Maven, you can include this as a dependency, otherwise download the file and add it as a library in your project.
If you need a different version of the library, move up one directory in the link that I added above, you can find other versions there as well.
If you want to automate the class generation, since you're changing the schema on a regular basis, you should automate the process, e.g through Maven.
Upvotes: 6
Reputation: 565
Windows> Preferences> Java> InstalledJREs > Execution Environment. Select an environment JDK 1.8 and then try to create JAXB Classes.
Click on Below Image Link For Details.
Select the execution Environment
Upvotes: 3
Reputation: 332
Download com.springsource.com.sun.tools.xjc-2.1.7.jar
and configure the build path. This solved the warning and the error for me. Hope this helps.
Upvotes: 1
Reputation: 399
After a lot of research here is what I have done to fix the issue. Windows> Preferences> Java> InstalledJREs...make sure to point your jre to the jdk directory. I was pointing to JRE and as soon as I changed it to JDK, it started working. Hope this will help you guys.
Upvotes: 11
Reputation: 7603
Put the tools.jar in the classpath of the projecct (where the generated code will reside).
I found an explanation here https://bugs.eclipse.org/bugs/show_bug.cgi?id=345617 It does not work because Eclipse only 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.
Upvotes: 1