| JAXB 2.0 | Tools | JAXB 1.0.x | JAXB RI Extensions | JAXB Community |
The binding compiler can be launched using the appropriate
xjc shell script in the
bin directory
for your platform. We also provide an Ant task to run the binding
complier - see the instructions for
using xjc with Ant.
For Solaris/Linux
- % /path/to/jaxb/bin/xjc.sh -help
For WindowsNT/2000/XP
- > c:\path\to\jaxb\bin\xjc.bat -help
Output
Usage: xjc [-options ...] <schema file/URL/dir/jar> ... [-b <bindinfo>] ... If dir is specified, all schema files in it will be compiled. If jar is specified, /META-INF/sun-jaxb.episode binding file will be compiled. Options: -nv : do not perform strict validation of the input schema(s) -extension : allow vendor extensions - do not strictly follow the Compatibility Rules and App E.2 from the JAXB Spec -b <file/dir> : specify external bindings files (each <file> must have its own -b) If a directory is given, **/*.xjb is searched -d <dir> : generated files will go into this directory -p <pkg> : specifies the target package -httpproxy <proxy> : set HTTP/HTTPS proxy. Format is [user[:password]@]proxyHost:proxyPort -httpproxyfile <f> : Works like -httpproxy but takes the argument in a file to protect password -classpath <arg> : specify where to find user class files -catalog <file> : specify catalog files to resolve external entity references support TR9401, XCatalog, and OASIS XML Catalog format. -readOnly : generated files will be in read-only mode -npa : suppress generation of package level annotations (**/package-info.java) -no-header : suppress generation of a file header with timestamp -target (2.0|2.1) : behave like XJC 2.0 or 2.1 and generate code that doesn't use any 2.2 features. -enableIntrospection : enable correct generation of Boolean getters/setters to enable Bean Introspection apis -contentForWildcard : generates content property for types with multiple xs:any derived elements -xmlschema : treat input as W3C XML Schema (default) -relaxng : treat input as RELAX NG (experimental,unsupported) -relaxng-compact : treat input as RELAX NG compact syntax (experimental,unsupported) -dtd : treat input as XML DTD (experimental,unsupported) -wsdl : treat input as WSDL and compile schemas inside it (experimental,unsupported) -verbose : be extra verbose -quiet : suppress compiler output -help : display this help message -version : display version information -fullversion : display full version informationExtensions: -Xinject-code : inject specified Java code fragments into the generated code -Xlocator : enable source location support for generated code -Xsync-methods : generate accessor methods with the 'synchronized' keyword -mark-generated : mark the generated code as @javax.annotation.Generated -episode: generate the episode file for separate compilation -Xpropertyaccessors : Use XmlAccessType PROPERTY instead of FIELD for generated classes
Execute the
jaxb-xjc.jarJAR FileIf all else fails, you should be able to execute the
jaxb-xjc.jarfile:
- For Solaris/Linux:
- % java -jar $JAXB_HOME/lib/jaxb-xjc.jar -help
- For Windows:
- > java -jar %JAXB_HOME%\lib\jaxb-xjc.jar -help
This is equivalent of running "xjc.sh" or "xjc.bat", and it allows you to set the JVM parameters.
In general, it is safest to compile all related schemas as a single unit with the same binding compiler switches.
Please keep the following list of restrictions in mind when running xjc. Most of these issues only apply when compiling multiple schemas with multiple invocations of xjc.
XJC produces a set of packages containing Java source files and also jaxb.properties files, depending on the binding options you used for compilation. When generated, jaxb.properties files must be kept with the compiled source code and made available on the runtime classpath of your client applications: