Developing JAXB Applications Using EclipseLink MOXy, Release 2.7
  Go To Table Of Contents

Generating Java Classes from an XML Schema

Use the JAXB Compiler to generate Java classes from an XML schema. The generated classes will contain JAXB annotations that represent the XML binding metadata.

Running the JAXB Compiler

Use the .sh or .cmd file to run the JAXB Compiler:

<ECLIPSELINK_HOME>/eclipselink/bin/ <source-file.xsd> [-options]


<ECLIPSELINK_HOME>\eclipselink\bin\jaxb-compiler.cmd <source-file.xsd> [-options]

The JAXB Compiler supports the following options:

Option Description


Do not perform strict validation of the input schemas.


Allow vender-specific extensions; do not strictly follow the Compatibility Rules in Appendix E.2 of the JAXB specification

-b <file/directory>

Specify the external binding files to process.

Note: Each file must use its own -b flag.

-d <directory>

Specify the output directory for the generated files.

-p <package>

Specify the target package.

-classpath <arg>

Specify where to find user class files.


Enable additional compiler output, such as informational messages.


Disable compiler output.


Display the compiler version.

For example: -d jaxb-compiler-output config/Customer.xsd

To display a complete list of compiler options, use: -help