Java is one of the most widely used programming languages in the world, powering everything from Android apps to enterprise software. But is Java actually free to download and use? The short answer is yes – Java itself is free, but additional support from Oracle comes with a cost. In this in-depth guide, we‘ll cover everything you need to know about getting started with Java, including downloading, installing, and using it across different platforms.
What is Java and Why Does it Matter?
Java is a general purpose, object-oriented programming language and development platform first released by Sun Microsystems in 1995. It has since evolved to become one of the most popular languages used by developers today.
Here are some key facts about Java:
Platform independent: Java code can run on any device or operating system as long as a Java Virtual Machine (JVM) is installed. This "write once, run anywhere" approach is key.
Object-oriented: Java code is organized into classes and objects, making it easy to reuse and build upon existing code.
Robust ecosystem: Java has a massive open source ecosystem of libraries, frameworks, and developer tools.
Widely used: Java powers over 3 billion devices worldwide and is used by 95% of enterprise applications. Popular platforms like Android are built on Java.
Performance: Java code is compiled to bytecode and run on the JVM for fast execution speed and efficiency.
This powerful combination of portability, flexibility, and speed makes Java one of the top choices for developing enterprise applications, web apps, mobile apps, games, big data analysis, and more. Understanding Java unlocks career opportunities in many industries.
OpenJDK vs Oracle JDK: What‘s the Difference?
There are two main "flavors" of Java available:
OpenJDK: This is the free, open source implementation of Java that anyone can use without paying. OpenJDK 11 is the current long term support (LTS) version.
Oracle JDK: This is Oracle‘s commercially supported version of Java. Previous versions were free but beginning with JDK 11, Oracle now charges for JDK licenses and support.
Functionally, OpenJDK and Oracle JDK are very similar for developers. The key differences are related to support:
|Paid license required
|Commercial support from Oracle
|Regular updates from Oracle
|Open source only
|Proprietary additions from Oracle
For personal or small business use, OpenJDK is typically sufficient. But larger organizations often choose Oracle JDK for the SLA-backed support, frequent security patches, and enterprise management tools.
Is Java Free to Download and Use?
The Java language itself, along with the JVM and most Java libraries, are open source and completely free for anyone to download and use. Think of these core components like a "free tier" offering.
Even Oracle JDK downloads are free and don‘t require an account. You only need to pay if you want commercial support, managed updates, and Oracle‘s proprietary integrations.
So both individuals as well as organizations are free to build Java applications and deploy them commercially without paying anything to Oracle. The base Java SE platform has no upfront license fees.
Here are some examples of how Java can be used for free:
- Learning Java for academic projects or personal interest
- Building an Android app for the Google Play Store
- Developing a web application using Spring Boot and Tomcat
- Running a microservice with Java and Docker containers
- Using Java to analyze data or train machine learning models
- Making a game or utility app for Windows, Mac, or Linux
As long as you stick to the free and open source components like OpenJDK, Eclipse, and Linux, you won‘t have to pay anything to work with Java.
Oracle Java Subscription Pricing
While the Java language itself is free, Oracle now charges a subscription for continued access to Oracle JDK updates and commercial support:
- $15 per user/month for standard pricing
- Up to $2.50 per user/month for largest enterprises with over 375,000 employees
This new pricing model began in 2019 with the release of Java 11. Here‘s what‘s included in the paid Oracle Java SE subscription:
- License for Oracle JDK, including proprietary tools and integrations
- Bug fixes, security updates, and feature releases
- Around the clock production support
- Account management and licensing included
- Indemnification from intellectual property claims
- Embedded and bulk redistribution rights
- Access to Oracle technical support engineers
The older free versions like Java 8 will continue to work, but eventually reach end-of-life and stop receiving updates. For companies that rely on Java, paying the subscription may be worthwhile to always stay on a supported LTS version.
Downloading and Installing Java on Windows
Now that you know Java itself is free, let‘s walk through actually installing it on your system. We‘ll start with Windows, since it‘s the most common desktop OS.
Here are the steps to get Java on a Windows PC:
Download the Java installer from Oracle‘s website. Choose the x64 .exe for 64-bit machines or x86 for 32-bit.
Run the installer and step through the installation wizard. Choose your desired installation folder.
Set environment variables like
JAVA_HOMEto point to the JDK location and update your
PATHto include Java executables.
Verify the install by opening a command prompt and running
java -version. This should print details about the installed JDK.
Keep Java updated by periodically checking for new releases on Oracle‘s website. Remove old versions to avoid possible exploits.
On Windows, you can install multiple versions of Java side by side. But keeping older installations too long creates security risks. Remove deprecated versions after transitioning your apps to an updated JDK.
Installing Java on Mac
Installing Java on macOS is very similar to the process on Windows:
Download the DMG archive for macOS from Oracle.
Open the DMG and run the install wizard.
Follow the prompts to install the JDK into your Applications folder.
Add the full path to the
binfolder of the JDK install to your PATH variable.
java -versionin Terminal to verify.
Check for updates to download newer versions of Java for Mac as needed.
MacOS typically comes with an outdated version of Java preinstalled. It‘s best to keep this for system services only, and install an updated Java JDK for your development work.
Installing Java on Linux
Linux installation depends on the specific distro, but here are a few common methods:
Package manager: Install OpenJDK via
pacman, etc. depending on your distro.
Download tar.gz: Extract the gzipped tarball to a directory like
/opt/then set environment variables.
Third party repository: Some distros include community repositories with OpenJDK packages.
Build from source: Clone the OpenJDK Mercurial repos and compile the source code yourself.
Using your distro‘s package manager is generally the easiest option. For example on Ubuntu/Debian:
sudo apt update
sudo apt install default-jdk
Check your installed version with
java -version and update frequently for security patches.
Java Platform Editions Explained
There are three main "editions" of Java targeted at different use cases:
Java SE (Standard Edition) – The core Java programming platform. This includes the JVM, the Java Class Library, command line tools, and basic UI libraries like Swing. Used for developing general purpose applications.
Java EE (Enterprise Edition) – An expanded framework for building robust, scalable enterprise applications using distributed, multi-tier architectures. Adds APIs for messaging, transaction management, and web services.
Java ME (Micro Edition) – A lightweight version of Java for smaller devices like mobile phones, embedded systems, and IoT devices. Offers core Java functionality and smaller footprint.
Most developers start with Java SE as their baseline installation, then add libraries or frameworks like Spring, Hibernate, etc. Java EE is declining in favor of lighter frameworks like Spring Boot, Micronaut, and Quarkus.
Building Java Applications
Once you have Java installed, you can start building applications using one of these popular free, open source tools:
IntelliJ IDEA – Advanced IDE for Java development featuring code completion, debugging, testing, deployment, and more.
Eclipse – Extensible IDE with support for Java and plugins for many frameworks and languages.
NetBeans – Lightweight IDE optimized for Java, particularly good for new developers.
JDK Tools – The JDK includes command line tools for compiling (
javac), running (
java), archiving (
jar), documentation (
javadoc), and more.
Apache Maven – Build automation and project management tool that handles dependencies and build configuration.
Gradle – Flexible build system that allows builds using Groovy or Kotlin DSL instead of XML.
I generally recommend IntelliJ IDEA to most Java developers, especially those using frameworks like Spring Boot. It has the best code intelligence and powerful debugging capabilities.
Key Takeaways and Recommendations
Here are some key points to remember about installing and using Java:
- The Java SE platform itself is 100% free to download, install, and use for any purpose.
- OpenJDK provides a free implementation without paying Oracle.
- Oracle Java subscriptions provide additional proprietary tools, updates, and commercial support.
- Keep Java up-to-date on your machines to avoid potential security issues.
- Use a modern IDE like IntelliJ IDEA to streamline your Java development workflow.
- Java is a great choice for building cross-platform applications, especially with frameworks like Spring Boot and Quarkus.
- With over 9 million developers worldwide, Java skills offer fantastic career opportunities.
Java really is free for development, so there‘s minimal risk involved with trying it out for your next software project. Download an OpenJDK distribution, fire up IntelliJ IDEA Community Edition, and enjoy exploring Java‘s capabilities!