There are a couple of things you need to do in order to get the Unifi controller working on Ubuntu 17.04:
1. Change the init file to contain the correct path to Java
You can follow the instructions in this post
2. Change the memory allocation for the Unifi controlle
Simply run the following command in the terminal:
echo "JSVC_EXTRA_OPTS="$JSVC_EXTRA_OPTS -Xss1280k"" | sudo tee -a /etc/default/unifi