On macOS set java_home, maven_home is not as easy as in windows after you install JDK or maven. Do not worry, this article will tell you how to do it in macOS.
This article will tell you how to install/uninstall multiple java versions on mac os both use homebrew or manually. It also shows you how to set JAVA_HOME & PATH system environment variable to make your installed JDK as the default JDK. We recommend you to use homebrew because it provides a lot of easy-to-use tools.