Java is a general-purpose, secure, robust, object-oriented language developed by Sun Microsystems in 1990. Java is portable which means it follows to write once run anywhere paradigm. Many of the useful application are build on Java and required Java runtime environment. If you are preparing your system for the developing new java applications, you need to install JDK on your machine.
The latest version is Java 15 which was released in September 15, 2020. This tutorial helps you to install Java on macOS system.
Step 1 – Prerequisites
Before starting the installation of Java using this tutorial you must have the following prerequisites
Mac OS X 10.6 and below: Apple's Java comes pre-installed with your Mac OS. Mac OS X 10.7 (Lion) and above: Java is not pre-installed with Mac OS X versions 10.7 and above. To get the latest Java from Oracle, you will need Mac OS X 10.7.3 and above. If you have Java 7 or later versions, you will see a Java icon under System Preferences. Follow this guide for text editor mac download for free, Best Text Editors for Mac OS 2018. Bracket is one of the most commonly used text editor for Mac that comes for free, looks like mac default text editor. It is also simple text editor mac. It is an open source text editor which has till date maintained its big name in tech.
Mac OS X 10.6 and below: Apple's Java comes pre-installed with your Mac OS. Mac OS X 10.7 (Lion) and above: Java is not pre-installed with Mac OS X versions 10.7 and above. To get the latest Java from Oracle, you will need Mac OS X 10.7.3 and above. If you have Java 7 or later versions, you will see a Java icon under System Preferences. Download for Mac Mac OS X 10.10 or later. This computer will no longer receive Google Chrome updates because Mac OS X 10.6 - 10.9 are no longer supported. How to install Java JDK Java Development Kit on mac. In Mac OSX 10.5 or later, Apple recommends to set the $JAVAHOME variable to /usr/libexec/javahome, jus.
Terminal: You must have Mac Terminal access and little knowledge about working with the terminal application. Ao login to your Mac system and open terminal
Homebrew: This tutorial relies on Homebrew, So you must have homebrew installed. Homebrew can be installed with a single command.
For more instruction visit Homebrew installation tutorial.
Step 2 – Install JAVA on macOS
At the time of writing this tutorial the available version, Java 11 LTS and Java 15 latest for the installation.
Tap adoptopenjdk/openjdk- Use the following commands to view the details about java versions to be install.
Search Available JDK- View all the available Java versions to install
Install Java – Use one of the following commands to install Java 8, 9, 10, 11, 12, 13, 14 and 15. Generally, we required Java 8, 11 LTS versions.
The installation process may take some time to complete depending on your network speed.
Check Version – Once the installation finished, verify the installed Java version.
Default latest installed version will be active on your machine.
Java For Mac Os Catalina
Step 3 – Switching Between Java Version’s
You system may have installed multiple Java versions. For example, I have installed Java 8, 11 and 15 on my system. To view the installed Java version execute:
Create or edit the existing ~/.bash_profile in your favorite text editor. Then export JAVA_HOME environment variable to specific java version, you want to use as default on Mac.
Download Java For Macos 2017-001
Save file and close it. The above settings will make JAVA_HOME point to JAVA 11.
Execute the following command to reload environment.
How To Download Java For Mac
All done, check the current active java version
When you want to switch JDK version again, update the ~/.bash_profile and export JAVA_HOME to other JDK version.
Conclusion
Update Java Mac Os
This tutorial explained you to how to install Java on macOS. Also provides you steps to switching between multiple installed Java versions.