Unifi Controller: Could not find Java SE runtime environment under macOS

Starting the Unifi Controller under recent macOS versions with OpenJDK installed can cause problems, such as one of the following warnings:

  • Could not find a JRE. Will look for a JDK.
  • ERROR: could not find Java SE runtime 

I’m going to assume you have Adopt OpenJDK installed, preferably via Homebrew – if not, then install Homebrew and then:

brew tap AdoptOpenJDK/openjdk
brew cask install adoptopenjdk8

After this, you should be able to run Java runtime on your Mac – let’s get back to making UniFi Controller run.

First, we need to link our current Java to the UniFi.app

sudo ln -s /Library/Java/JavaVirtualMachines/adoptopenjdk-8.jdk/ /Applications/UniFi.app/Contents/PlugIns

Then we need to open and edit Info.plist

sudo nano /Applications/UniFi.app/Contents/Info.plist

And add the following JVMRuntime section manually after the JVMOptions

<key>JVMRuntime</key>
<string>adoptopenjdk-8.jdk</string>

After this, the UniFi Controller should run without problems.

Reposted from the Ubiquiti forum – original author: Andreas