added JAVA_HOME support for OSX installation.
better exception message.