I'm trying to build a gradle project on Mac with Java 9, but I'm getting this error:
FAILURE: Build failed with an exception.
Caused by: java.lang.ClassNotFoundException: javax.xml.bind.JAXBElement
Java version is:
java version "9.0.1"
Java(TM) SE Runtime Environment (build 9.0.1+11)
Java HotSpot(TM) 64-Bit Server VM (build 9.0.1+11, mixed mode)
How do I add JAXB to the classpath? This projects builds on Windows and other computers OK without adding JAXB.
You're seeing this because of changes in Java 9. Here's how to solve that: How to resolve java.lang.NoClassDefFoundError: javax/xml/bind/JAXBException in Java 9
However, if your project is written for Java 8 (or older), what I would really suggest is letting Gradle know about that in your build.gradle:
...
plugins {
id 'java'
}
sourceCompatibility = 1.8
targetCompatibility = 1.8
...
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With