How do I install Java?
How to install Java on your computer
To run Java apps, open JAR files or compile some source code into bytecode you’ll need to install Java.
To download and install Java on Windows, MacOS or Ubuntu, follow these steps:
- Allocate 400 MB of hard drive space for the Java download and installation.
- Decide between a JDK or JRE installation.
- Choose the version of Java that best meets your requirements.
- Select the Java distribution to install.
- Download the Java install media and perform the installation.
- Configure JAVA_HOME after the Java install completes.
- Finally add the Java \bin directory to your computer’s PATH.
The easiest way to get Java installed for most users? Just download and install the latest version of the Java Development Kit (JDK) from Eclipse called Adoptium. It comes with everything a casual user and even a Java developer needs.
What do I need to install Java?
All you need to install Java is a network connection so you can download the JDK, and about 300 MB of download space to store the setup files and perform the installation.
The hardware requirements to run Windows 11, Ubuntu or a MacBook all far exceed the Java Runtime Environment’s (JRE) CPU and memory requirements. So as long as you’ve got a computer that can host a modern operating system (OS), you’re ready to install Java on your computer
How do I install Java on Windows 11?
The easiest way to install Java on Windows 10 or Windows 11 is to download the JDK from the Eclipse Adoptium project.
The Wizard will step you through the Java install on Windows. Accept all of the defaults, and the Java installation on Windows will complete in less than 90 seconds.
The Adoptium install media installs the latest long-term support (LTS) release of Java, which is Java version 17.
How to install Java on Ubuntu?
You can install Java on Ubuntu with a single apt command:
sudo apt install default-jdk Setting up default Ubuntu jdk install headless (2:1.11-72build2) ... Setting up openjdk 11 on Ubuntu jdk:amd64 ... using /usr/lib/jvm/java-11-openjdk-amd64/bin/jconsole Installing Java on Ubuntu (2:1.11-72build2) ... Java install on Ubuntu complete ...
When you install Java on Ubuntu 22, the default-jdk sets up a Java 11 configuration.
How to install Java on MacOS?
There are several ways to install Java on MacOS. The easiest is brew.
To install Java and configure the PATH variable on MacOS, just issue the following commands:
brew install openjdk export PATH="/usr/local/opt/openjdk/bin:$PATH"
How can I tell if Java is installed on my computer?
You don’t need to install Java if it’s already installed. To see if Java is already installed on your computer, just issue the Java version command:
java -version openjdk Java install version "11.0.15" 2022-04-19 Open JAR JDK Runtime Environment JRE install (build 11.0.15) OpenJDK 64-Bit Server JVM install (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1)
If the command displays information about the version of the installed Java JDK, then you know Java is already installed.
If the command generates a Java not recognized error then you do not have Java installed, and you can proceed with a JDK installation.
Is Java free to install?
Java is free to install.
Some vendors sell extended support for older versions of the JDK. Other vendors sell versions of Java that are incredibly scalable and more robust than distributions built from the OpenJDK baseline.
But only enterprise customers who install Java on powerful servers need to pay for Java.
For all other users, Java is free to use. However, anyone who installs Java should always read the license agreement before they accept it.
Which Java distribution should I choose?
Many vendors build their own Java distribution from the OpenJDK project. Vendors with their own Java distributions include:
- Azul Zulu, Core and Prime
- The Oracle JDK
- Adoptium from Eclipse (formerly AdoptOpenJDK)
- Dragonwell from Alibaba
- Amazon Corretto
- The Microsoft build of the JDK
- The Red Hat JDK
- Liberica from Bellsoft
For everyday users, the best option is to download and install Java through the Adoptium JDK from Eclipse. It’s open source, it’s built directly from the OpenJDK project, and it has the least restrictive Java license.
Otherwise, if you are a developer and you have a relationship with a given vendor, or you deploy to a given vendor’s platform, it makes sense to install their Java distribution rather than the Adoptium one.
For users who want enterprise performance and scalability and will pay for extended Java support, the Azul JDK has always been the preferred choice.
Should I install the JDK or JRE?
To execute Java programs and run Java JAR files, the minimum requirement is the Java Runtime Environment (JRE).
Developers who want to compile code, create JARs and build applications need the JDK, which includes source code compilers and other necessary utilities.
My recommendation is to always install the JDK unless there is some overriding concern that makes a JRE install more attractive. Occasionally Java programs require a compiler or some other utility in the Java install’s /bin folder. Install the JDK rather than the JRE to avoid these corner-cases.
What version of Java should I install?
The latest long-term support release of Java is version 17. This is the preferred version to install. Bug fixes and security patches will continue to be released for it.
A default JDK install on Ubuntu uses Java 11, which was the previous LTS release before Java 17 came out.
Java 11 is also a very capable version of the JDK. Both Java 11 and Java 17 are acceptable versions of Java to install and will fulfill the majority of needs for most Java users.
|Configuration option||Installation default||Recommended setting|
|Install directory||C:\Program Files\||Change the Java install folder to one that does not have any spaces or non-standard characters in the name|
|Enable .jar file double-clicks||Yes||Yes|
|Configure the PATH variable||Yes||Yes|
What is the latest version of Java to install?
The LTS Java 17 release came out in September 2021.
New Java releases come out every six months. So in March 2022, Java 18 was released. However, the releases that come out every six months are not LTS releases, which now come out every two years.
When you install Java, you should install the latest LTS release, not the latest six-month increment. Non-LTS releases are not recommended unless they contain a specific feature that a user needs.
Should I install Java on my computer?
You don’t need to install Java on your computer. Many users never install Java on their Windows or Linux machines.
However, if you want to play a Java based game like Minecraft you need to install Java.
And if you want to develop Java applications, you must install Java and the JDK on your computer.
If you do need to install Java, rest easy, because the various installers on the market today have made the process easier than ever.