java上的Gradle,linux和hello word返回java.lang.ExceptionInInitializerError

时间:2017-05-20 15:39:00

标签: java gradle build build.gradle

我已经GradleJVMUbuntu

$ gradle -v
------------------------------------------------------------
Gradle 3.5
------------------------------------------------------------
Build time:   2017-04-10 13:37:25 UTC

Groovy:       2.4.10
Ant:          Apache Ant(TM) version 1.9.6 compiled on June 29 2015
JVM:          9-ea (Oracle Corporation 9-ea+162)
OS:           Linux 4.10.0-21-generic amd64

我在java上有intellij项目。 enter image description here

我的Gradle配置:

apply plugin:'java'

当我运行gradle build时:

$ gradle build 

FAILURE: Build failed with an exception.

* What went wrong:
java.lang.ExceptionInInitializerError (no error message)

可能出现错误?

1 个答案:

答案 0 :(得分:0)

它帮助了我:

export JDK_JAVA_OPTIONS='--add-opens=java.base/java.lang=ALL-UNNAMED --add-opens=java.base/java.io=ALL-UNNAMED --add-opens=java.base/java.util=ALL-UNNAMED'

只需在终端执行即可。