Downloading the XJC Eclipse plugin

In order to download the XJC Eclipse plugin follow this link. After the download is complete, unzip the archive contents under the plugins directory of your Eclipse installation and launch Eclipse.

Using the XJC Eclipse plugin

The XJC Eclipse plugin adds a new popup menu entry for files with extension .xsd. Here we have a simple workspace with a schema file (click to see full screenshot):



Right-click on a schema file - see the new menu and the XJC menu item:



Choosing the "Run XJC" menu item brings up the XJC configuration wizard. This wizard contains two pages, mandatory settings and optional settings. Once the mandatory settings are valid, the "Finish" button is enabled, allowing you to skip the optional settings. The mandatory settings are: root output directory and package name for the generated files:



At the first run, the root output directory is empty (and the error message is shown with "Finish" button disabled) and the package is "org.example". In order to change the output directory, press "Change" button and navigate to the directory of your choice:



Once both mandatory parameters are valid, you can either click "Next" to provide optional parameters or "Finish" to run the XJC generator:



The package name must conform to JLS sections 3.8 and 7.7. This restriction is partly checked (XJC generator makes stricter checks):



In our example, we change the package name to "org.example.first":



Pressing "Next" brings up the second wizard page for specifying additional optional XJC parameters:



In our example, we change the default settings to:



When "Finish" is pressed, the XJC generator is executed on the original schema files with all parameters specified in the wizard screens. The generated files (root output directory) are linked from the project of the original schemas after XJC completes successfully:



As usual, double-clicking the java file brings it up in the editor:



When you run the XJC wizard the next time, it takes the values from the last run. Here is the initial screen for mandatory settings for the consecutive wizard execution in our example - notice that the values are restored and the "Finish" button is enabled:



Here is the initial screen for optional settings for the consecutive wizard execution in our example - notice that the values are restored:



The same scenario applies to the "real-world" schemas. Here, we run XJC on FPML schemas:



Unshown in the simple example (but present there as well), we have a progress modal dialog for tracking down the progress of XJC generator:







The last screen shows the error markers put in the "Problems" view when XJC reports errors in the input schemas: