Java Home Directory Fail Issue on Ubuntu – RESOLVED

Java Home Directory Fail Issue on Ubuntu – RESOLVED

For those of you who’re building your Ubuntu from scratch or even if you did like me and install UniFi on an AirVision NVR, , you might or might not get this after installing UniFi Controller

*Setting Java Home….fail

If that do happen, this might be because since the new Ubuntu, the name of the Java homedir changed according to the CPU architecture used and UniFi is using a hard-coded variable for the Java path in its startup script for some reason. You should change the homedir by editing the init script. (We won’t get into much detail about what is init)

1. Open the init script
sudo nano /etc/init.d/unifi

2. Scroll down with your arrow key, look for a variable called
JAVA_HOME=/usr/lib/jvm/java-6-openjdk

3. Add your instance architecture type after that string.
For example, I’m using amd64bit in my instance, the string should become
JAVA_HOME=/usr/lib/jvm/java-6-openjdk-amd64
DO NOT touch anything else.

4. After the edit just enter Ctrl-X and it will ask you wheter it should save or discard the change. We of course want to save it. Press Y, and press ENTER to save it with the same file name. The nano editor will close

5. Do this string to restart our UniFi Controller.
sudo service unifi restart

6. You suceed when you see
* Starting Ubiquiti UniFi Controller unifi [ OK ]