I'm new to maven but I would like to use it to run simple deeplearing4j program. After adding all the necessary dependencies I get the following: Error:java: release version 5 not supported
After following the instructions at this page (changing my SDK, language and target byte code to 11)
I'm getting this:
Error:java: java.lang.ExceptionInInitializerError
com.sun.tools.javac.code.TypeTags
Error:java: java.lang.ExceptionInInitializerError
I've also tried setting JDK 14 but I get the same error. Here is my pom.xml file:
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.example</groupId>
<artifactId>Deep</artifactId>
<version>1.0-SNAPSHOT</version>
<properties>
<maven.compiler.source>1.11</maven.compiler.source>
<maven.compiler.target>1.11</maven.compiler.target>
<dl4j.version>0.9.1</dl4j.version>
</properties>
<dependencies>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-native-platform</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-core</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.datavec</groupId>
<artifactId>datavec-api</artifactId>
<version>${dl4j.version}</version>
</dependency>
<dependency>
<groupId>org.nd4j</groupId>
<artifactId>nd4j-api</artifactId>
<version>1.0.0-beta3</version>
</dependency>
<dependency>
<groupId>org.deeplearning4j</groupId>
<artifactId>deeplearning4j-play_2.11</artifactId>
<version>0.9.1</version>
</dependency>
</dependencies>
</project>
If anybody can shed some light on what I might be doing wrong here I would appreciate it.
We can resolve the java. lang. ExceptionInInitializerError by ensuring that static initializer block of classes does not throw any Runtime Exception. We can resolve also resolve this exception by ensuring that the initializing static variable of classes also doesn't throw any Runtime Exception.
An ExceptionInInitializerError is thrown to indicate that an exception occurred during evaluation of a static initializer or the initializer for a static variable. As of release 1.4, this exception has been retrofitted to conform to the general purpose exception-chaining mechanism.
This is wrong.
<maven.compiler.source>1.11</maven.compiler.source>
<maven.compiler.target>1.11</maven.compiler.target>
Post Java 1.9, the version naming has changed. Make the following changes in the pom.xml.
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
The same convention follows from 10+ Java version.
The real issue is: one of library org.deeplearning4j:deeplearning4j-core:jar:0.9.1:compile this jar having a dependency on org.projectlombok:lombok:jar:1.16.16:compile.
So this was an issue with Lombok which they fixed in a later version. To see all transitive dependencies you can do a mvn dependency:tree
and see all transitive dependencies of the libraries you have brought in.
I have included the below dependency in the pom and that resolved the issue.
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.2</version>
<scope>provided</scope>
</dependency>
Add this to pom.xml:
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>1.18.20</version>
<scope>provided</scope>
</dependency>
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