If you're using the same terminal, go ahead and clear it with CMD + K. The latest version as of 08/26/20 is 3.6.3.Įxport M2_HOME=/Applications/apache-maven-3.6.3 Version number will vary based on when you're reading this. bash_profile again and add these two variables. Once it's downloaded, move it into your Applications folder and unzip it ( unzip apache-maven-3.6.3-bin.zip).This tutorial follows downloading the binary zip archive file. Add export JAVA_HOME=$(/usr/libexec/java_home) to the file and save it.bash_profile, go ahead and create one with touch. If you run echo $JAVA_HOME and it returns blank, it means you haven't set the variable yet. bash_profile, you can skip the next step). Next, you'll need to add the $JAVA_HOME variable in your.In your terminal, if you run java -version again now, it should return details of the installed JDK.You can check the installed Java path by going to your Mac's Settings > Java > Java (within the Java Control Panel) > Path.If you don't have a JDK installed, you can download it here. Open a new terminal and run java -version.You can skip the first half if you already have Java JDK installed. The system will not install a JRE that has an earlier version than the current version.I've needed to set up Java and Maven enough times that I figured I should write about it so that it's an easier setup for at least one other person.
When you install the JRE, you can install only one JRE on your system at a time. To install an earlier version of the JRE, you must first uninstall the current version. To determine the current JRE version installed on your system, see Determining the JRE Version Installed on macOS. However, the system will not replace the current JRE with a lower version. When you install the JDK, it also installs the JRE.
Administrator privileges are required to install the JDK and JRE on macOS. Installing the JDK and JRE on macOS is performed on a systemwide basis for all users. You cannot install Java for a single user. The following are the system requirements for installing the JDK and the JRE on macOS: