Setting JAVA_HOME through function.