<html><head><link rel="canonical" href="https://www.jetbrains.com/help/idea/generating-java-code-from-xml-schema.html.md/" data-react-helmet="true"/></head><body># Generate Java Code from XML Schema

This topic describes how to get a Java representation of an [XML Schema](https://www.w3schools.com/xml/schema_intro.asp), which involves mapping the elements of the XML Schema to members of a Java class. With IntelliJ&nbsp;IDEA, this transformation can be done using one of the following data binders:

* [JAXB](#jaxb) generates classes and groups them in Java packages. A package consists of a Java class name and an `ObjectFactory` class. The latter is a factory that is used to return instances of a bound Java class.

* [XMLBeans](#xmlbeans) converts an XML Schema into a Java class, compiles it, and places it in the specified output `jar` file.

Procedure: Install the Jakarta EE: Web Services (JAX-WS) plugin

This functionality relies on the [Jakarta EE: Web Services (JAX-WS)](https://plugins.jetbrains.com/plugin/18584-jakarta-ee-web-services-jax-ws)  plugin, which   you need to install and enable.

&gt; **Note:**
&gt; The Jakarta EE: Web Services (JAX-WS) plugin is not available in IntelliJ&nbsp;IDEA without the Ultimate subscription.

1. Press `Ctrl+Alt+S` (Windows), `⌘ Comma` (macOS), `⌘ Comma` (IntelliJ IDEA Classic (macOS)), `⌘ Comma` (macOS System Shortcuts), `Ctrl+Alt+S` (XWin), `Ctrl+Alt+S` (GNOME), `Ctrl+Alt+S` (KDE), `Ctrl+Alt+S` (Emacs), `Ctrl+Alt+S` (Sublime Text), `⌘ Comma` (Sublime Text (macOS)), `Ctrl+Alt+S` (NetBeans), `Ctrl+Alt+S` (Visual Studio), `⌘ Comma` (Visual Studio (macOS)), `Ctrl+Alt+S` (Eclipse), `⌘ Comma` (Eclipse (macOS))  to open settings and then select `Plugins`.

2. Open the Marketplace tab, find the Jakarta EE: Web Services (JAX-WS) plugin, and click Install (restart the IDE if prompted).

Procedure: Generate a Java class from an XML Schema using JAXB

1. In the active editor tab, open a Schema `.xsd` file or an XML document, which contains the Schema you need.

2. In the main menu, go to `Tools | XML Actions | Generate Java Code From XML Schema Using JAXB`.

3. In the [Generate Java from Xml Schema using JAXB](generate-java-from-xml-schema-using-jaxb-dialog.html) dialog, configure the generation procedure:

* In the Schema/DTD/WSDL Path list, specify the file to be used as the basis for code generation. By default, the field shows the full path to the current file. Accept this suggestion or click Browse ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.ellipsis.svg) and select a file in the Select XML Schema File for JAXB Generation that opens.

* From the Output Path list, select the module source directory to place the generated Java class in.

* In the Package Prefix list, specify the package to include the generated stubs in.

* Using the checkboxes, configure additional options, such as generating annotation, setting the read-only status, downloading and installing additional libraries.

&gt; **Note:**
&gt; The XMLBeans integration in IntelliJ&nbsp;IDEA is compatible with XMLBeans 2.x. XMLBeans 3.x and later use a different installation layout, so the selected directory may be rejected or code generation may fail.
&gt;
&gt;
&gt;
&gt;
&gt;
&gt; If you use XMLBeans 3.x or later, either use XMLBeans 2.6.0, create a symbolic link named `xbean.jar` that points to the XMLBeans JAR file in the `lib` directory, or use the [XMLBeans Maven](https://mvnrepository.com/artifact/org.codehaus.mojo/xmlbeans-maven-plugin) plugin instead. Learn more from a [YouTrack issue](https://youtrack.jetbrains.com/issue/IDEA-386213/Settings-for-Web-Services-do-not-accept-file-URLs).

Procedure: Generate and compile a Java class from an XML Schema using XMLBeans

1. In the active editor tab, open a Schema `.xsd` file or an XML document, which contains the Schema you need.

2. In the main menu, go to `Tools | XML Actions | Generate Java Code From XML Schema Using XmlBeans`.

3. In the [Generate Java Code From XML Schema using XMLBeans](generate-java-code-from-xml-schema-using-xmlbeans-dialog.html) dialog, configure the generation procedure:

* In the Schema Path list, specify the file to be used as the basis for code generation. By default, the field shows the full path to the current file. Accept this suggestion or click Browse ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.ellipsis.svg) and select a file in the Select XML Schema /WSDL File for Generation dialog that opens.

* In the Output Path list, specify the name of the `jar` file to place the generated and compiled Java code in. By default, IntelliJ&nbsp;IDEA suggests creating a new file `types.jar`. To overwrite an existing file, click Browse ![the Browse button](https://resources.jetbrains.com/help/img/idea/2026.2/app.general.ellipsis.svg) and choose the desired file in the Select XML Schema / Wsdl File for generation dialog that opens.

* To have missing libraries downloaded and installed automatically, select the Add necessary libraries in order for generated code compile and work checkbox.

</body></html>