JAXB XJC plugin not working

Answered

I'm a new user of Intellij.  I'm currently using the trial software while my company gets a license in January.  So far the experience is mostly good!

I'm using Java 9 on a Windows 10 machine and have the jdk installed in Program Files\java and my program compiles fine.  However, I'm in need of a Java code generator from xsd.  My experience is with xjc so I started by trying to use Intellij's facilities to use it.  I've even installed the plugin for it.  But I keep getting the below error.  

xjc Error

"Error: Could not find or load main class com.sun.tools.internal.xjc.Driver Caused by: java.lang.ClassNotFoundException: com.sun.tools.internal.xjc.Driver"

Is this a Java 9 vs Java 8 difference?

1
16 comments

Do you use https://www.jetbrains.com/help/idea/generate-java-from-xml-schema-using-jaxb-dialog.html feature? Note that you don't need to install any additional plug-ins for that. Does the error come from the built-in WebServices plug-in or from the third-party plug-in you've installed?

Did you try it with Java 8 or older?

 

0
Avatar
Permanently deleted user

I am using the generate JAXB from xml schema feature.  That is the one which is giving me the error.  

This wasn't working before I tried adding plugins.  After reading, I thought the problem may of been missing plugins so I added the JAXB 2.0 xjc generator thinking that may of been the issue.  

I have also installed XMLBeans Integration because it also complains about missing path in plugin settings.  It seems like something that should come with it.  

I have not tried using Java 8.  Is Java 9 not fully supported yet?

 

 

 

0

I've verified that it works correctly with Java 8.

It doesn't work with Java 9 because of the JDK 9 bug: https://bugs.java.com/bugdatabase/view_bug.do?bug_id=8132554.

It has no relation to IntelliJ IDEA.

0
Avatar
Permanently deleted user

Thank you for your help so far.  That is very interesting because it runs when I execute xjc from the command line.

0

Are you sure xjc is using Java 9 from when you run it from the command line?

0
Avatar
Permanently deleted user

When I run java --version from the command line, it prints out 9.0.1

0

I've checked that xjc.exe from Java 9 works, looks like it handles the classpath changes correctly.

Please follow https://youtrack.jetbrains.com/v2/issue/IDEA-179691 for updates.

0
Avatar
Permanently deleted user

Thank you.  I will watch that area.

0
Avatar
Permanently deleted user

I am in the process of upgrading to the new version and in the process of evaluation, I discovered that I am getting the same error running with java version "10.0.2" 2018-07-17. The tool doesn't work. If there is no work around, i will have to stay with the old version of IntelliJ.

0

in java 11 same problem:

Error: Could not find or load main class com.sun.tools.internal.jxc.SchemaGenerator

4
Avatar
Permanently deleted user

I do have the same problem. 

Java Version:

java version "11.0.1" 2018-10-16 LTS
Java(TM) SE Runtime Environment 18.9 (build 11.0.1+13-LTS)
Java HotSpot(TM) 64-Bit Server VM 18.9 (build 11.0.1+13-LTS, mixed mode)

Error Message:

Error: Could not find or load main class com.sun.tools.internal.xjc.Driver
Caused by: java.lang.ClassNotFoundException: com.sun.tools.internal.xjc.Driver

4

I have the same error and I have to say that this is Ultimate embarrassing. The answers of the support guy are... I'm not saying this. Then the linked tickets. What a shame. Why not fixing this? Why not realizing that there is OpenJDK without the Sun classes?

0

I do have the same problem. 

Java Version:

openjdk version "11.0.11" 2021-04-20
OpenJDK Runtime Environment GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05)
OpenJDK 64-Bit Server VM GraalVM CE 21.1.0 (build 11.0.11+8-jvmci-21.1-b05, mixed mode, sharing)

Error Message:

Error: Could not find or load main class com.sun.tools.internal.xjc.Driver
Caused by: java.lang.ClassNotFoundException: com.sun.tools.internal.xjc.Driver

Why has this problem not been resolved yet? Adding the jaxb-xjc dependency to the classpath does not work.

 

1

Hi! We are working on this problem, please follow https://youtrack.jetbrains.com/v2/issue/IDEA-179691

0

Any update on this one?

@... The issue under your link is in fixed status, however for me it is still showing the same error pop-up with the missing xjc Driver...

0

The IDEA-179691 JAX-WS: Generate XML Schema from Java using JAXB action does not work with JDK > 8

issue has been fixed. The fix will be available since 2021.3.1 IDE versions (reflected in Available in field in YouTrack issue). Please try 2021.3.1 RC from https://confluence.jetbrains.com/display/IDEADEV/IDEA+2021.3+latest+builds

1

Please sign in to leave a comment.