Creating java classes from xsd file - JAXB

I am trying to learn how to create web services with Java. I added the JAXB plugin to the eclipse / plugin folder and I restarted eclipse. I added the .xsd file to the source folder in eclipse and I am trying to create classes from the xsd file. The tutorial mentions that when I right-click on the .xsd file, I should see the JAXB 2.1 β†’ run XJC parameter, but I do not see such an option in my eclipse installation. I only see the "Generate -> JAXB Classes option". If I select this option and force classes, it gives an error message:

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. Couldn't find the main class com.sun.tools.xjc.XJFacade. 

Can someone help me figure out why I don’t see this option on an eclipse? I tried both Galileo and Helios.

+8
eclipse eclipse-plugin jaxb
source share
4 answers

Check installed JRE in eclipse

Preferences> Java> Installed JRE

If it points to jre, then point it to the jdk installation directory. He fixed the error for me

+12
source share

Go to window-> Preferences β†’ Installed JRE

If you point to the JRE, then the problem with the JDK will be resolved.

enter image description here

+5
source share

The Eclipse Dali project (part of the Eclipse Web Tools Project) introduced the new JAXB toolkit, which is available in the Indigo Eclipse release :

+2
source share

Sorry to be the necromancer of this post!

On linux distributions, this may be the result of using openjdk-* packages rather than oracles. Official oracle java can be installed after this tutorial

Whenever I see the sun mentioned in the exception, it usually reverts to open-jdk vs oracle-jdk

0
source share

All Articles