Reputation: 21668
I've downloaded Gradle and copied bin/gradle to my /usr/bin folder. I've also added GRADLE_HOME=/user/bin to my ~/.bash_profile. If I run
$ gradle -v
I get this error:
$ gradle -v
Exception in thread "main" java.lang.NoClassDefFoundError: /usr/bin/java
Caused by: java.lang.ClassNotFoundException: .usr.bin.java
at java.net.URLClassLoader$1.run(URLClassLoader.java:202)
at java.security.AccessController.doPrivileged(Native Method)
at java.net.URLClassLoader.findClass(URLClassLoader.java:190)
at java.lang.ClassLoader.loadClass(ClassLoader.java:306)
at sun.misc.Launcher$AppClassLoader.loadClass(Launcher.java:301)
at java.lang.ClassLoader.loadClass(ClassLoader.java:247)
My java is here:
$ which java
/usr/bin/java
Finally, this is my .bash_profile:
export GRADLE_HOME=/usr/bin
export GRADLE_OPTS=/usr/bin/java
export PATH=${GRADLE_OPTS}:${GRADLE_HOME}:${PATH}
What's wrong? I've followed all http://www.gradle.org/docs/current/userguide/installation.html steps.
SOLVED
Now
$ gradle -v
returns ...
$ gradle -v
------------------------------------------------------------
Gradle 1.8
------------------------------------------------------------
Build time: 2013-09-24 07:32:33 UTC
Build number: none
Revision: 7970ec3503b4f5767ee1c1c69f8b4186c4763e3d
Groovy: 1.8.6
Ant: Apache Ant(TM) version 1.9.2 compiled on July 8 2013
Ivy: 2.2.0
JVM: 1.6.0_65 (Apple Inc. 20.65-b04-462)
OS: Mac OS X 10.9 x86_64
Upvotes: 2
Views: 1977
Reputation:
Thought I'll write an answer for this (including my comment above). One way is to have the gradle copied to some folder in /usr/local
or to /opts
and add a symlink to gradle
and place it in /usr/bin
. This is the manual way of doing things.
A more easier way is to install the GVM (Groovy Environment Manager) script and let the script take care of installation and removal. You can easily have multiple version of Groovy, Grails, Gradle, Griffon without having to setup symlinks and stuff. The only thing is that it saves everything in your home directory.
Install the script.
curl -s get.gvmtool.net | bash
To install gradle give the command,
gvm install gradle
See the url linked above to read more above GVM.
Upvotes: 1