0

I'm trying to install gradle and but I keep getting the error:

ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-6-sun/bin

When I type in echo $JAVA_HOME I get

/usr/lib/jvm/java-6-sun/bin

and that same path is specified in .bashrc as well so I really have no idea what is happening. I tried to google this problem but the closest issue I could find to my own was this question but I don't think I'm having quite the same problem and the solutions don't seem to work anyway.

I installed java by following this tutorial and I installed gradle first by trying these steps and when that didn't work, I removed gradle and tried it this way. Both times I got the same error message whenever I typed in gradle.

I've only been using Ubuntu for a few months so I'm still learning the OS and how to use it. Any help troubleshooting the issue here would be much appreciated.

Community
  • 1
  • 1
SoSimple
  • 701
  • 9
  • 30

1 Answers1

1

Try set JAVA_HOME to location without bin folder:

/usr/lib/jvm/java-6-sun
Gondy
  • 4,925
  • 4
  • 40
  • 46
  • run the command: sudo gedit ~/.bashrc , look for the JAVA_HOME variable definition, edit it like @Gondy's advice and it will work. – Ahmed Abobakr Jul 16 '15 at 10:31
  • I've tried that and now I get the same error with the new path: ERROR: JAVA_HOME is set to an invalid directory: /usr/lib/jvm/java-6-sun – SoSimple Jul 16 '15 at 10:40
  • You have written you have tried to install Oracle JDK 8. Why are you pointing to java 6 sun? – Gondy Jul 16 '15 at 10:48
  • I didn't set the path myself, I used ` sudo apt-get install oracle-java8-set-default` from the tutorial I linked to in the question. I'll see if I can find the java8 path and change it to that... – SoSimple Jul 16 '15 at 10:54
  • Okay so I found the java8 folder and set my path to `/usr/lib/jvm/java-8-oracle`. Everything seems to be working, `gradle -version` doesn't give an error at the very least so thank you for your help! – SoSimple Jul 16 '15 at 11:07