Issue
I attempted to run the code gen with this command line as described in the documentation here:
java -classpath "jooq-3.12.3.jar;jooq-meta-3.12.3.jar;jooq-codegen-3.12.3.jar;mysql-connector-java-5.1.18-bin.jar;." org.jooq.codegen.GenerationTool library.xml
I get the following error:
Jan 10, 2020 5:10:45 PM org.jooq.tools.JooqLogger info
INFO: Initialising properties : library.xml
Exception in thread "main" java.lang.NoClassDefFoundError: javax/xml/bind/annotation/XmlSchema
at org.jooq.util.jaxb.tools.MiniJAXB.getNamespace(MiniJAXB.java:389)
...
I'm using Java 11:
openjdk version "11.0.5" 2019-10-15
OpenJDK Runtime Environment AdoptOpenJDK (build 11.0.5+10)
OpenJDK 64-Bit Server VM AdoptOpenJDK (build 11.0.5+10, mixed mode)
What am I missing? PS. I'm very new to the world of Java...
Solution
The problem is connected with removal of JAXB api as it was considered a part of JAVA EE API, thus removed form JDK since Java 9 (see this question for details).
You can solve your problem by adding jaxb-api jar to your classpath :
java -classpath "jooq-3.12.3.jar;jooq-meta-3.12.3.jar;jooq-codegen-3.12.3.jar;reactive-streams-1.0.2.jar;mysql-connector-java-5.0.7.jar;jaxb-api-2.3.1.jar" org.jooq.codegen.GenerationTool library.xml
Notice that I also had to add reactive-streams-1.0.2 jar to the classpath (as the tutorial mentions).
And change the MySQL driver jar to your jar in the command I pasted. So the final command in your case will be :
java -classpath "jooq-3.12.3.jar;jooq-meta-3.12.3.jar;jooq-codegen-3.12.3.jar;reactive-streams-1.0.2.jar;mysql-connector-java-5.1.18-bin.jar;jaxb-api-2.3.1.jar" org.jooq.codegen.GenerationTool library.xml
Answered By - Michał Krzywański
Answer Checked By - Cary Denson (JavaFixing Admin)