简体   繁体   中英

Could not find or load main class com.sun.tools.internal.xjc.Driver

I want to use IntelliJ tool and generate Java code from XML schema using JAXB but I'm encountering error problem mentioned above.

JAXB tool window

This is my.xsd file i want to generate code from:

<?xml version="1.0" encoding="UTF-8" ?>
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema"
           xmlns:tns="http://localhost:9090/api/productions/list"
           targetNamespace="http://localhost:9090/api/productions/list"
>

    <xs:element name="getProduction">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="id" type="xs:long"/>

            </xs:sequence>
        </xs:complexType>
    </xs:element>

    <xs:element name="getResponse">
        <xs:complexType>
            <xs:sequence>
                <xs:element name="production" type="tns:production"/>

            </xs:sequence>
        </xs:complexType>
    </xs:element>
    
    <xs:complexType name="production">
        <xs:sequence>
            <xs:element name="id" type="xs:long"/>
            <xs:element name="guid" type="xs:string"/>
            <xs:element name="name" type="xs:string"/>
        </xs:sequence>
    </xs:complexType>

</xs:schema>

Anyone know what the problem is?

I'm afraid running jxc from IntelliJ IDEA is not supported on JDK versions 9 and above. Please see IDEA-179691 and related issues for more information.

The "Generate Xml Schema from Java using JAXB" action should work with Java 8.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM