Fix Mac OSTYPE error and add JAVA_HOME for linux.