Fixing solr error: The currently defined JAVA_HOME refers to a location where Java could not be found

If you uninstall Java, or it is installed in a way that the solr service can’t see, you can get the following error:

The currently defined JAVA_HOME (/usr/lib/jvm/java-8-oracle) refers
to a location where Java could not be found.  Aborting.
Either fix the JAVA_HOME variable or remove it from the
environment so that the system PATH will be searched.

To fix this, you can edit /etc/default/solr.in.sh, and add the following line (adjust to match your JDK):

SOLR_JAVA_HOME="/usr/lib/jvm/java-7-openjdk-i386"

2 Replies to “Fixing solr error: The currently defined JAVA_HOME refers to a location where Java could not be found”

  1. +1.

    Thanks man. Some hour and a half trying to make it work in Debian 10. For anyone who arrives here, my problem was that I have installed java 8 and java 11 at the same time. I tried install when java was java 8. I don’t know if Solr new versions have some incompatibility with Openjdk 8. First I tried update-alternatives to Openjdk 11, and then reinstall solr but the JAVA_HOME environment variable is recovered after manually delete it. I set the SOLR_JAVA_HOME and solr server got up and running.

Leave a Reply

Your email address will not be published. Required fields are marked *