I can't set up JAVA_HOME. Before you dismiss this as a noob's question who can't figure out how to Google things let me explain my situation.

I bought RaspberryPi and installed Raspbian onto an SD card following tutorial steps. Everything seemed normal until I started tinkering with it and installing some stuff like maven, tomcat, logstash or solr.

Every tool complained about not finding java in JAVA_HOME. No biggie. I found which java, followed some symbolic links to find java in /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/java. Java came with my Raspbian I did not install it. So I added:

export JAVA_HOME="/usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt"
export PATH=$PATH:$JAVA_HOME/bin

at the end of ~/.bashrc I'm no sysadmin but I did that a couple of times so no worries.

I was wrong. Regardless of where I put those lines (/etc/environment, ~/.bashrc, ~/.profile) JAVA_HOME doesn't seem to be set up. When I echo $JAVA_HOME lo and behold there it is, pointing as supposed to.

When I type mvn -v it returns:

Error: JAVA_HOME is not defined correctly.
  We cannot execute /usr/lib/jvm/jdk-8-oracle-arm-vfp-hflt/bin/java

So I checked permissions:

pi@raspberrypi:~ $ ls -laR /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/java
-rwxr-xr-x 1 root root 3384 Dec  9  2015 /usr/lib/jvm/jdk-8-oracle-arm32-vfp-hflt/bin/java

But everyone has +x

I tried rebooting, using source, nothing works. I'm out of ideas. Please help me Raspberry aficionados.

1 Answer 1


Your JAVA_HOME points to a different directory than where your java executable is located. Per your question, the JAVA_HOME directory is:


whereas java is located in


Note the arm vs. arm32.

  • Of course it had to be my stupidity... Apr 13, 2017 at 17:17

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.