I am trying to useXJCto generate Java classes from XSD. I am wondering how can I do this?

So far, I've done the following:

  • Downloaded and unpackedJAXB
  • Set to system variableJAXB_HOMEmeaningC: \ Program Files \ Java \ jaxb-ri-2.3.1(address of the directory into which the contents of the jaxb-ri-2.3.1 archive are unpacked)

Apparently this is not enough, since when writing the command in the consolexjca message appears stating that this is an unknown command. Although in the guides that I watched, this was enough.

What else can I do to solve my problem?

Windows 8.1 system, used standard Windows command line and Git Bash for commands.

  • Answer # 1

    I found a way to install thatXJCwill work correctly:

    • and setJAXB(in my case version 2.3.1). Moreover, the installation path should not contain spaces (for me it was decisive).
    • Download and installJDK(I downloaded version 15.0.2 from the Oracle site, but this is not the point).
    • Now you need to fix the filexjc.bat, which is located in\jaxb-ri-2.3.1\bin: replace/lib/on the/mod/,activation.jaron theactivation-api.jarandrelaxngDatatype.jaron therelaxng-datatype.jar. A source.
    • Set to environment variableJAVA_HOMEpath to the folder where the files are locatedJDK.
    • Set to environment variableJAXB_HOMEpath to the folder where the files are locatedJAXB.
    • Add to environment variablePATHway%JAXB_HOME%\binand%JAVA_HOME%\bin

    After that, you can runXJCfrom the console using the commandxjc.bat.