How To Download And Install Java On Mac

Reading Time: 6minutes

FREE Courses - If you are using MacOS Catalina, you need to set JAVAHOME in.zprofile instead of.bashprofile.

What is Java?

Java is considered one of the most popular programming languages. Java is a typed object-oriented programming language developed by Sun Microsystems (and subsequently acquired by Oracle). Development is mainly performed by a community organized through the Java Community Process. The language and the main technologies that implements it are distributed under the GPL but the trademark rights are owned by Oracle Corporation. Code written in Java (using the JVM – Java Virtual Machine) is transformed into bytecode and due to this, programs can run on any system where the JVM is installed. Therefore, Java is often called a cross-platform language. Most often, Java is used to develop backend programs and android applications.

  • With Mac OS 10.7 (Lion) and later, the Java runtime is no longer installed automatically as part of the OS installation. Follow any of the methods below to install Java runtime.
  • How to Download and Install Java JDK on Mac OS X Do you want to know how to install the Java JDK 11 (Java SE Development Kit) on your Mac? Well, you're in th.

Java JDK and Java JRE

There are two packages needed to install Java, the Java JDK and Java JRE.

  • Java JRE (Java Runtime Environment) – is necessary for running programs on computers and contains JVM, class libraries (Java Class Library), console commands. JRE is not enough for programming and creating programs. Install JRE only for programs that need to use Java in their projects.
  • Java JDK (Java Development Kit) – is necessary for developers and it includes JRE, javac compiler and other tools necessary for development in Java. If you plan to use Java in development, you need to use this version of the package.

Java SE and Java EE.

There are 2 main classifications of Java platforms, Java SE and Java EE. These are defined below.

  • Java SE – This is the Java Standard Edition. It is the main Java edition that contains the compiler, API, JRE and is suitable for creating custom applications, primarily for desktop systems.
  • Java EE – This is the Java Enterprise Edition. It includes a set of specifications used mainly for creating enterprise-level software.

Java versions.

Currently, the latest version is Java 13, however, the most popular and widely used version is Java 8. In many circumstances, it is not always the best choice to use the latest versions in programming languages. The reason being because many times, there are functions that are introduced in later versions which do not always work well with older versions.

Install Java For Mac

OpenJDK

We will use OpenJDK as this software is a project created to be an open-source, fully compatible Java JDK consisting exclusively of free and open-source code. By installing this package we can use it for free, but other implementations of Java may require a paid option.

SDKMAN

One other thing, if you are planning to use Java in a development environment, we would advise the use of SDKMAN. This is a command-line utility which allows us to install multiple versions of Java, and it handles the variable settings for us. It is convenient to use, but we will try to do accomplish the installation without it first, and then show the process using the help of SDKMAN.

Installation on Ubuntu 18

Install OpenJDK

Let’s begin by installing Java OpenJDK 13 on Ubuntu 18.04. First, we need to check and see if we have Java installed using the following command.

This indicates that Java is not currently installed.

Download Java SDK 13

Our next step includes downloading the Java SDK (or software developer kit). We will accomplish this by using the wget command.

Working Directory

Next, we will create a working directory where Java will reside, change directories into that folder, copy the downloaded file into that directory, and finally, extract the tar.gz file into its directory.

Set Environment Variables

The Set Environment Variables step is necessary because when using Java, Ubuntu needs to know where the program is located to run it from, and which Java version to use by default. To modify this, we will use the nano text editor. First, open the file in Nano.

And

Next, scroll to the bottom of the file and paste this information.

Finally, we press ctrl + O + Y + Enter then ctrl + X + Enter to save and close the file.

Finishing the Configuration Setup

Our last step involves updating the information in our system to point the new program and its options. In this case, we update the information regarding the Java installation.

Version Check

As a final verification, we can check the installation and the version using the following command.

Installation on Windows 10.

In order to install the Windows version of Java, we need to visit the official Java website and download the Windows executable. Once at the site, the licensing options are outlined in green. It states “The new Oracle Technology Network License Agreement for Oracle Java SE is substantially different from prior Oracle JDK licenses. The new license permits certain uses, such as personal use and development use, at no cost — but other uses authorized under prior Oracle JDK licenses may no longer be available. Please review the terms carefully before downloading and using this product. An FAQ is also available.

Commercial license and support is available with a low cost Java SE Subscription.” We will scroll down to see the available downloads.

We will be downloading the jdk-13.0.2_windows-x64_bin.exe version.

After we click on the selected version, we must accept the user agreement.

Once the download completes, run the executable.

Click next and agree with the selected folders by default. Click Close when complete.

Setup Environment Variables

JAVA_HOME is a variable that points to the directory in which Java is installed. Programs use it to determine where Java is located.

Click on the keyboard combination Win+R, the Run window will pop up, and we then enter the command control / name Microsoft.system.

Next, select Advanced system settings

Now, click on Environment Variables.

Now, choose Path, and then click on New.

Enter the name: JAVA_HOME. Next, specify the path. If you selected the default path, you will see the path C:Program FilesJavajdk-13.0.2

Next, select PATH edit.

Then, we click New and enter the following.

%JAVA_HOME%bin

And click OK in all open windows.

Now, to verify everything, we will open the run console with the Windows+r command and enter cmd and then press enter.

Now, we will enter the following command to check if everything works as expected.

Next, we will check the Java version using the following command.

Excellent! Let’s move on.

Install Java On Mac Os

Installation on MacOS

There are several options on how to do it. We can do the same way as we did in Ubuntu or Windows. Since we are installing the JDK version for developers, and in the future we will need to be able to install some programs, we will install through the console. We launch the console. If you do not know how to enter the terminal, open the directory below, then in Applications -> Utilities -> Terminal.

For macOS we will use the SDKMAN utility, it is often used when you need to install several versions and configure it, SDKMAN does everything by itself. Conveniently, this installation can be used on macOS and Ubuntu.

Add SDKMAN Repository

In the initial step, we will install the SDKMAN repository.

Set Environment Variable

Next, we will set the environment variable.

Now, we can check to ensure SDKMAN is installed.

Now, we can review a list of Java versions.

Install JDK 13

Next, we will select the version JDK 13 and install it.

Now we can set the default Java version to use.

Verify Version

Lastly, we can check the version of Java using the following command.

And that’s it! We installed Java on macOS.

Conclusion

In this tutorial, we learned what Java is, which versions are available to install on multiple platforms. Finally, we learned how to install, configure and run Java on Ubuntu, Windows and MacOS.

Want to Join an Elite Group of Experts? Find Out if You’re Eligible!

Give us a call at 800.580.4985, or open a chat or ticket with us to speak with one of our knowledgeable Solutions or Experienced Hosting advisors to learn how you can take advantage of this technology today!

Related Articles: