Created attachment 206754 [details]
Patch for newer Java support
Based on https://community.ui.com/questions/Running-Unifi-Controller-on-Java-9-10-and-11/f1ac1330-40b8-4af6-83b6-8d55e48e4a32 I have a patch for the unifi5 port that will allow it to run with newer versions of Java.
Note that testing has been light. I've only started it and navigated to the set up page, I haven't tried to do anything beyond that. I've tested with both openjdk8 and openjdk11 so far.
Feel free to use this or not.
Created attachment 207594 [details]
I've updated the patch based on the update of the port to 5.11.39
Mark, any comments on this?
(In reply to Greg Lewis from comment #2)
Haven't had time to test it myself, but if it works I'll take it. :-)
Thanks for being persistent.
The only change I see worth making is to avoid using that echo and shell expansion trick. I don't want us to run into shell expansion limits (or bugs) in the future, so we can just hack it with find, and replace sed with tr which is faster
find /usr/local/share/java/unifi/lib/ -maxdepth 1 -type f -name '*.jar' | tr '\n' ':'
(In reply to Mark Felder from comment #4)
ok that didn't work so well because of trailing : character with this method. My research shows your approach isn't uncommon. My main concern is now the process list output is blown up by this HUGE monster classpath definition. I've worked around it by setting the env CLASSPATH instead.
I'm not entirely sure why we're moving from the java -jar ace.jar method to this classpath definition and telling java to run "com.ubnt.ace.Launcher start" instead, but I trust you know far more about Java than I do.
A commit references this bug:
Date: Wed Sep 18 17:38:00 UTC 2019
New revision: 512281
net-mgmt/unifi5: Update to 5.11.46
Also pull in port improvements from glewis@ to enable customizing which Java
that Unifi runs with
There is an explanation of why it switches from a direct java -jar invocation to using the class path and naming the main class at
The tl;dr version is that JDK9+ needs activation.jar on the class path and this is the simplest way to get it there.
Note that I assume unifi will eventually support Java 11 out of the box, so we can likely revert to a straight java -jar invocation at that point.
Thanks, and please let me know if you encounter any issues with the changes I've committed.