-e
-f
-d
adding local variable flag and setting the variable if java home isn't taken care of in the first if check. For some reason there were different tab widths for this bottom section, unifying to what the top was at -- 2 spaces.
binaries, this fixes that. This also sets JAVA_HOME (only tested on OSX).