UniFi controller: Cannot locate Java Home on Ubuntu 16.04

Create /etc/default/unifi and add:

JAVA_HOME="$( readlink -f "$( which java )" | sed "s:bin/.*$::" )"

Solution found on the ubnt forums.

Note: to correctly run UniFi controller you need Java from Oracle, otherwise you will get errors like:

[2018-11-07 16:20:53,060] <launcher> ERROR JreMemoryLeakPreventionListener - Failed to trigger creation of the GC Daemon thread during Tomcat start to prevent possible memory leaks. This is expected on non-Sun JVMs.

To solve install Java from the webupd8 team ppa and make sure it’s used as default with:

update-alternatives --configure java

UniFi controller headless installation on Ubuntu 16.04

👉 NOTICE: These instructions doesn’t work anymore as of April 2019. See updated steps here.

A quick recap:

apt -y install software-properties-common
add-apt-repository -y ppa:webupd8team/java
echo 'deb http://www.ubnt.com/downloads/unifi/debian stable ubiquiti' | tee /etc/apt/sources.list.d/100-ubnt-unifi.list
apt-key adv --keyserver keyserver.ubuntu.com --recv 06E85760C0A52C50 
apt update
apt -y install oracle-java8-installer
update-alternatives --set java /usr/lib/jvm/java-8-oracle/jre/bin/java
apt install unifi

Original UniFi article here.

3 pensieri su “UniFi controller: Cannot locate Java Home on Ubuntu 16.04

  1. thank you for this article.
    > update-alternatives –configure java
    did not work for me on ubuntu 16.04
    i used
    > update-alternatives –config java
    to make it work

Lascia un commento

Il tuo indirizzo email non sarà pubblicato. I campi obbligatori sono contrassegnati *

Solve : *
30 + 19 =

Questo sito usa Akismet per ridurre lo spam. Scopri come i tuoi dati vengono elaborati.