Export JAVA_HOME only when it is available.