I checked in VisualVM what system properties are set and in there I see the last one on the command line. So it seems we want the order on the CMD to be ```ACTIVATOR_OPTS``` ```SBT_OPTS``` ```JAVA_OPTS```.  Perhaps this is JVM dependent though?

As for the ```get_mem_opts``` it uses the ```mem``` variable to determine if it should add memory options or not. Or have I completely misunderstood how the script works?