{
    "mode": "man",
    "parameter": "xjc",
    "section": "1",
    "url": "https://www.chedong.com/phpMan.php/man/xjc/1/json",
    "generated": "2026-06-15T13:12:37Z",
    "synopsis": "xjc [ options ] schema file/URL/dir/jar ... [-b bindinfo ] ...\noptions\nThe command-line options. See Options.\nschema file/URL/dir/jar ...\nThe location of the XML schema file. If dir is specified, then all schema files in it\nare compiled. If jar is specified, then the /META-INF/sun-jaxb.episode binding file is\ncompiled.\n-b bindinfo\nThe location of the bindings files.",
    "sections": {
        "NAME": {
            "content": "xjc - Compiles an XML schema file into fully annotated Java classes.\n",
            "subsections": []
        },
        "SYNOPSIS": {
            "content": "xjc [ options ] schema file/URL/dir/jar ... [-b bindinfo ] ...\n\n\noptions\nThe command-line options. See Options.\n\nschema file/URL/dir/jar ...\nThe location of the XML schema file. If dir is specified, then all schema files in it\nare compiled. If jar is specified, then the /META-INF/sun-jaxb.episode binding file is\ncompiled.\n\n-b bindinfo\nThe location of the bindings files.\n",
            "subsections": []
        },
        "DESCRIPTION": {
            "content": "Start the binding compiler with the appropriate xjc shell script in the bin directory for\nyour platform. There is also an Ant task to run the binding complier. See Using the XJC with\nAnt at http://jaxb.java.net/nonav/2.1.3/docs/xjcTask.html\n",
            "subsections": []
        },
        "OPTIONS": {
            "content": "• See also Nonstandard Options\n\n• See also Deprecated and Removed Options\n",
            "subsections": [
                {
                    "name": "-nv",
                    "content": "By default, the XJC binding compiler performs strict validation of the source schema before\nprocessing it. Use this option to disable strict schema validation. This does not mean that\nthe binding compiler will not perform any validation, but means that it will perform a\nless-strict validation.\n"
                },
                {
                    "name": "-extension",
                    "content": "By default, the XJC binding compiler strictly enforces the rules outlined in the\nCompatibility chapter of the JAXB Specification. Appendix E.2 defines a set of W3C XML\nSchema features that are not completely supported by JAXB v1.0. In some cases, you may be\nallowed to use them in the -extension mode enabled by this switch. In the default (strict)\nmode, you are also limited to using only the binding customization defined in the\nspecification. By using the -extension switch, you will be allowed to use the JAXB Vendor\nExtensions.\n\n-b file\nSpecifies one or more external binding files to process. Each binding file must have its\nown -b switch. The syntax of the external binding files is flexible. You can have a single\nbinding file that contains customization for multiple schemas or you can break the\ncustomization into multiple bindings files: xjc schema1.xsd schema2.xsd schema3.xsd -b\nbindings123.xjbxjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bindings2.xjb -b\nbindings3.xjb. In addition, the ordering of the schema files and binding files on the\ncommand line does not matter.\n\n-d dir\nBy default, the XJC binding compiler generates the Java content classes in the current\ndirectory. Use this option to specify an alternate output directory. The output directory\nmust already exist. The XJC binding compiler does not create it for you.\n\n-p pkg\nWhen you specify a target package with this command-line option, it overrides any binding\ncustomization for the package name and the default package name algorithm defined in the\nspecification.\n\n-httpproxy proxy\nSpecifies the HTTP or HTTPS proxy in the format [user[:password]@]proxyHost[:proxyPort].\nThe old -host and -port options are still supported by the RI for backward compatibility,\nbut they were deprecated. The password specified with this option is an argument that is\nvisible to other users who use the top command. For greater security, use the\n-httpproxyfile option.\n\n-httpproxyfile file\nSpecifies the HTTP or HTTPS proxy with a file. The same format as the -httpproxy option,\nbut the password specified in the file is not visible to other users.\n\n-classpath arg\nSpecifies where to find client application class files used by the jxb:javaType and\nxjc:superClass customization.\n\n-catalog file\nSpecifies catalog files to resolve external entity references. Supports the TR9401,\nXCatalog, and OASIS XML Catalog formats. See XML Entity and URI Resolvers at\nhttp://xerces.apache.org/xml-commons/components/resolver/resolver-article.html\n"
                },
                {
                    "name": "-readOnly",
                    "content": "By default, the XJC binding compiler does not write-protect the Java source files it\ngenerates. Use this option to force the XJC binding compiler to mark the generated Java\nsources as read-only.\n"
                },
                {
                    "name": "-npa",
                    "content": "Suppresses the generation of package level annotations into /package-info.java. Using\nthis switch causes the generated code to internalize those annotations into the other\ngenerated classes.\n"
                },
                {
                    "name": "-no-header",
                    "content": "Suppresses the generation of a file header comment that includes some note and time stamp.\nUsing this makes the generated code more compatible with the diff command.\n\n-target 2.0\nAvoids generating code that relies on any JAXB 2.1 features. This will allow the generated\ncode to run with JAXB 2.0 runtime environment (such as Java SE 6).\n"
                },
                {
                    "name": "-xmlschema",
                    "content": "Treats input schemas as W3C XML Schema (default). If you do not specify this switch, then\nyour input schemas are treated as though they are W3C XML Schemas.\n"
                },
                {
                    "name": "-relaxing",
                    "content": "Treats input schemas as RELAX NG (experimental and unsupported). Support for RELAX NG\nschemas is provided as a JAXB Vendor Extension.\n"
                },
                {
                    "name": "-relaxing-compact",
                    "content": "Treat input schemas as RELAX NG compact syntax (experimental and unsupported). Support for\nRELAX NG schemas is provided as a JAXB Vendor Extension.\n"
                },
                {
                    "name": "-dtd",
                    "content": "Treats input schemas as XML DTD (experimental and unsupported). Support for RELAX NG\nschemas is provided as a JAXB Vendor Extension.\n"
                },
                {
                    "name": "-wsdl",
                    "content": "Treats input as WSDL and compiles schemas inside it (experimental and unsupported).\n"
                },
                {
                    "name": "-quiet",
                    "content": "Suppress compiler output, such as progress information and warnings.\n"
                },
                {
                    "name": "-verbose",
                    "content": "Be extra verbose, such as printing informational messages or displaying stack traces upon\nsome errors.\n"
                },
                {
                    "name": "-help",
                    "content": "Displays a brief summary of the compiler switches.\n"
                },
                {
                    "name": "-version",
                    "content": "Displays the compiler version information.\n\nschema file/URL/dir\nSpecifies one or more schema files to compile. If you specify a directory, then the xjc\ncommand scans it for all schema files and compiles them.\n\nNONSTANDARD OPTIONS"
                },
                {
                    "name": "-XLocator",
                    "content": "Causes the generated code to expose SAX Locator information about the source XML in\nthe Java bean instances after unmarshalling.\n"
                },
                {
                    "name": "-Xsync-methods",
                    "content": "Causes all of the generated method signatures to include the synchronized keyword.\n"
                },
                {
                    "name": "-mark-generated",
                    "content": "Marks the generated code with the annotation @javax.annotation.Generated.\n\n-episode file\nGenerates the specified episode file for separate compilation.\n\nDEPRECATED AND REMOVED OPTIONS\n-host & -port\nThese options are replaced with the -httpproxy option. For backward compatibility,\nthese options are supported, but will not be documented and might be removed from\nfuture releases.\n"
                },
                {
                    "name": "-use-runtime",
                    "content": "Because the JAXB 2.0 specification has defined a portable runtime environment, it is\nno longer necessary for the JAXB RI to generate /impl/runtimepackages. Therefore,\nthis switch is obsolete and was removed.\n"
                },
                {
                    "name": "-source",
                    "content": "The -source compatibility switch was introduced in the first JAXB 2.0 Early Access\nrelease. This switch is removed from future releases of JAXB 2.0. If you need to\ngenerate 1.0.x code, then use an installation of the 1.0.x code base.\n"
                }
            ]
        },
        "COMPILER RESTRICTIONS": {
            "content": "In general, it is safest to compile all related schemas as a single unit with the same\nbinding compiler switches. Keep the following list of restrictions in mind when running the\nxjc command. Most of these issues only apply when you compile multiple schemas with multiple\ninvocations of the xjc command.\n\nTo compile multiple schemas at the same time, keep the following precedence rules for the\ntarget Java package name in mind:\n\n1.  The -p option has the highest precedence.\n\n2.  jaxb:package customization.\n\n3.  If targetNamespace is declared, then apply the targetNamespace to the Java package name\nalgorithm defined in the specification.\n\n4.  If no targetNamespace is declared, then use a hard coded package named generated.\n\nYou cannot have more than one jaxb:schemaBindings per name space, so it is impossible to have\ntwo schemas in the same target name space compiled into different Java packages.\n\nAll schemas being compiled into the same Java package must be submitted to the XJC binding\ncompiler at the same time. They cannot be compiled independently and work as expected.\n\nElement substitution groups that are spread across multiple schema files must be compiled at\nthe same time.\n",
            "subsections": []
        },
        "SEE ALSO": {
            "content": "• Binding Compiler (xjc) at http://jaxb.java.net/nonav/2.2.3u1/docs/xjc.html\n\n• Java Architecture for XML Binding (JAXB) at\nhttp://www.oracle.com/technetwork/articles/javase/index-140168.html\n\n\n\nJDK 8                                     21 November 2013                                    xjc(1)",
            "subsections": []
        }
    },
    "summary": "xjc - Compiles an XML schema file into fully annotated Java classes.",
    "flags": [
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "By default, the XJC binding compiler performs strict validation of the source schema before processing it. Use this option to disable strict schema validation. This does not mean that the binding compiler will not perform any validation, but means that it will perform a less-strict validation."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "By default, the XJC binding compiler strictly enforces the rules outlined in the Compatibility chapter of the JAXB Specification. Appendix E.2 defines a set of W3C XML Schema features that are not completely supported by JAXB v1.0. In some cases, you may be allowed to use them in the -extension mode enabled by this switch. In the default (strict) mode, you are also limited to using only the binding customization defined in the specification. By using the -extension switch, you will be allowed to use the JAXB Vendor Extensions. -b file Specifies one or more external binding files to process. Each binding file must have its own -b switch. The syntax of the external binding files is flexible. You can have a single binding file that contains customization for multiple schemas or you can break the customization into multiple bindings files: xjc schema1.xsd schema2.xsd schema3.xsd -b bindings123.xjbxjc schema1.xsd schema2.xsd schema3.xsd -b bindings1.xjb -b bindings2.xjb -b bindings3.xjb. In addition, the ordering of the schema files and binding files on the command line does not matter. -d dir By default, the XJC binding compiler generates the Java content classes in the current directory. Use this option to specify an alternate output directory. The output directory must already exist. The XJC binding compiler does not create it for you. -p pkg When you specify a target package with this command-line option, it overrides any binding customization for the package name and the default package name algorithm defined in the specification. -httpproxy proxy Specifies the HTTP or HTTPS proxy in the format [user[:password]@]proxyHost[:proxyPort]. The old -host and -port options are still supported by the RI for backward compatibility, but they were deprecated. The password specified with this option is an argument that is visible to other users who use the top command. For greater security, use the -httpproxyfile option. -httpproxyfile file Specifies the HTTP or HTTPS proxy with a file. The same format as the -httpproxy option, but the password specified in the file is not visible to other users. -classpath arg Specifies where to find client application class files used by the jxb:javaType and xjc:superClass customization. -catalog file Specifies catalog files to resolve external entity references. Supports the TR9401, XCatalog, and OASIS XML Catalog formats. See XML Entity and URI Resolvers at http://xerces.apache.org/xml-commons/components/resolver/resolver-article.html"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "By default, the XJC binding compiler does not write-protect the Java source files it generates. Use this option to force the XJC binding compiler to mark the generated Java sources as read-only."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Suppresses the generation of package level annotations into /package-info.java. Using this switch causes the generated code to internalize those annotations into the other generated classes."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Suppresses the generation of a file header comment that includes some note and time stamp. Using this makes the generated code more compatible with the diff command. -target 2.0 Avoids generating code that relies on any JAXB 2.1 features. This will allow the generated code to run with JAXB 2.0 runtime environment (such as Java SE 6)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Treats input schemas as W3C XML Schema (default). If you do not specify this switch, then your input schemas are treated as though they are W3C XML Schemas."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Treats input schemas as RELAX NG (experimental and unsupported). Support for RELAX NG schemas is provided as a JAXB Vendor Extension."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Treat input schemas as RELAX NG compact syntax (experimental and unsupported). Support for RELAX NG schemas is provided as a JAXB Vendor Extension."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Treats input schemas as XML DTD (experimental and unsupported). Support for RELAX NG schemas is provided as a JAXB Vendor Extension."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Treats input as WSDL and compiles schemas inside it (experimental and unsupported)."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Suppress compiler output, such as progress information and warnings."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Be extra verbose, such as printing informational messages or displaying stack traces upon some errors."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Displays a brief summary of the compiler switches."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Displays the compiler version information. schema file/URL/dir Specifies one or more schema files to compile. If you specify a directory, then the xjc command scans it for all schema files and compiles them. NONSTANDARD OPTIONS"
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Causes the generated code to expose SAX Locator information about the source XML in the Java bean instances after unmarshalling."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Causes all of the generated method signatures to include the synchronized keyword."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Marks the generated code with the annotation @javax.annotation.Generated. -episode file Generates the specified episode file for separate compilation. DEPRECATED AND REMOVED OPTIONS -host & -port These options are replaced with the -httpproxy option. For backward compatibility, these options are supported, but will not be documented and might be removed from future releases."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "Because the JAXB 2.0 specification has defined a portable runtime environment, it is no longer necessary for the JAXB RI to generate /impl/runtimepackages. Therefore, this switch is obsolete and was removed."
        },
        {
            "flag": "",
            "long": null,
            "arg": null,
            "description": "The -source compatibility switch was introduced in the first JAXB 2.0 Early Access release. This switch is removed from future releases of JAXB 2.0. If you need to generate 1.0.x code, then use an installation of the 1.0.x code base."
        }
    ],
    "examples": [],
    "see_also": []
}