Improved java detection on OSX.