gradle -v不起作用并给出java错误

时间:2014-12-17 23:55:29

标签: gradle

我似乎无法安装openuse 13.2上的工作。

安装者:

sudo unzip -oq gradle-2.2.1-all.zip -d /opt/gradle
sudo ln -sfn gradle-2.2.1 /opt/gradle/latest
export GRADLE_HOME=/opt/gradle/latest
export PATH=$GRADLE_HOME/bin:$PATH

运行gradle:

$gradle -v
    java.lang.NoClassDefFoundError: org.gradle.util.CollectionUtils
       at java.lang.Class.initializeClass(libgcj.so.14)
       at org.gradle.internal.classpath.DefaultClassPath.<init>(DefaultClassPath.java:37)
       at org.gradle.api.internal.classpath.EffectiveClassPath.<init>(EffectiveClassPath.java:32)
       at org.gradle.api.internal.classpath.DefaultModuleRegistry.<init>(DefaultModuleRegistry.java:61)
       at org.gradle.api.internal.classpath.DefaultModuleRegistry.<init>(DefaultModuleRegistry.java:55)
       at org.gradle.launcher.bootstrap.ProcessBootstrap.runNoExit(ProcessBootstrap.java:44)
       at org.gradle.launcher.bootstrap.ProcessBootstrap.run(ProcessBootstrap.java:35)
       at org.gradle.launcher.GradleMain.main(GradleMain.java:23)
    Caused by: java.lang.ClassNotFoundException: com.google.common.collect.ImmutableList not found in gnu.gcj.runtime.SystemClassLoader{urls=[file:/opt/gradle/gradle-2.2.1/lib/gradle-launcher-2.2.1.jar], parent=gnu.gcj.runtime.ExtensionClassLoader{urls=[], parent=null}}
       at java.net.URLClassLoader.findClass(libgcj.so.14)
       at java.lang.ClassLoader.loadClass(libgcj.so.14)
       at java.lang.ClassLoader.loadClass(libgcj.so.14)
       at java.lang.Class.initializeClass(libgcj.so.14)
       ...7 more

2 个答案:

答案 0 :(得分:0)

您是否尝试在/ usr / bin中添加符号链接?

像这样:

sudo ln -s / opt / gradle / latest / bin / gradle / usr / bin / gradle

在openSuse 13.2中它对我有用

答案 1 :(得分:0)

确保gradle使用的是Java 1.8

> $JAVA_HOME/bin/java -version

应该返回

openjdk version "1.8.0_171"
OpenJDK Runtime Environment (IcedTea 3.8.0) (build 1.8.0_171-b11 suse-24.1-x86_64)
OpenJDK 64-Bit Server VM (build 25.171-b11, mixed mode)

我的盒子中有$ JAVA_HOME链接到Java 1.5