<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom" xmlns:dc="http://purl.org/dc/elements/1.1/">
  <channel>
    <title>DEV Community: PAKOU_Juste</title>
    <description>The latest articles on DEV Community by PAKOU_Juste (@juste_pakou).</description>
    <link>https://dev.to/juste_pakou</link>
    <image>
      <url>https://media2.dev.to/dynamic/image/width=90,height=90,fit=cover,gravity=auto,format=auto/https:%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Fuser%2Fprofile_image%2F1180183%2Fc935eff3-db57-4923-a704-c0c9086834df.png</url>
      <title>DEV Community: PAKOU_Juste</title>
      <link>https://dev.to/juste_pakou</link>
    </image>
    <atom:link rel="self" type="application/rss+xml" href="https://dev.to/feed/juste_pakou"/>
    <language>en</language>
    <item>
      <title>How to Install Java in 2026: Windows, Mac and Linux</title>
      <dc:creator>PAKOU_Juste</dc:creator>
      <pubDate>Mon, 30 Nov 2026 16:44:06 +0000</pubDate>
      <link>https://dev.to/juste_pakou/how-to-install-java-in-2026-windows-mac-and-linux-5620</link>
      <guid>https://dev.to/juste_pakou/how-to-install-java-in-2026-windows-mac-and-linux-5620</guid>
      <description>&lt;p&gt;There are hundreds of tutorials on installing Java. Most of them tell you to download the JDK from Oracle's website and click Next. In 2026, that advice has quietly become questionable — and almost no article has been updated to say so.&lt;/p&gt;

&lt;p&gt;This is the first post in a series on the OCP Java 21 certification. Before talking about the language, you need an environment that works and whose choices you understand. That's what this article covers: installing Java on all three operating systems, knowing why you're installing this version rather than another, and verifying everything works before writing a single line of code.&lt;/p&gt;

&lt;h2&gt;
  
  
  JRE or JDK: the question that blocks half of all beginners
&lt;/h2&gt;

&lt;p&gt;One mistake comes up constantly: installing the JRE, then wondering why &lt;code&gt;javac&lt;/code&gt; doesn't exist.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;JRE&lt;/strong&gt; (Java Runtime Environment) contains what you need to &lt;strong&gt;run&lt;/strong&gt; an already-compiled Java program: the virtual machine and the standard libraries. It's what the end user of an application needs.&lt;/p&gt;

&lt;p&gt;The &lt;strong&gt;JDK&lt;/strong&gt; (Java Development Kit) contains the entire JRE, &lt;strong&gt;plus&lt;/strong&gt; the development tools: the &lt;code&gt;javac&lt;/code&gt; compiler, the &lt;code&gt;javap&lt;/code&gt; disassembler, the &lt;code&gt;javadoc&lt;/code&gt; documentation tool, and the debugger.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxzwdponsy161dnoet8io.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fxzwdponsy161dnoet8io.png" alt="The JDK contains the JRE, plus the development tools: javac, javap, javadoc and the debugger" width="799" height="428"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;To develop — and therefore for this entire series — &lt;strong&gt;you need the JDK&lt;/strong&gt;. If you remember one thing from this section: the JDK contains the JRE, never the other way around.&lt;/p&gt;

&lt;h2&gt;
  
  
  Why a compiler at all, if Java is portable
&lt;/h2&gt;

&lt;p&gt;This is worth understanding, because it explains the whole toolchain.&lt;/p&gt;

&lt;p&gt;Java is neither fully compiled like C, nor interpreted like Python. It sits in between. You write &lt;code&gt;.java&lt;/code&gt; source files. The &lt;code&gt;javac&lt;/code&gt; compiler turns them into &lt;code&gt;.class&lt;/code&gt; files containing &lt;strong&gt;bytecode&lt;/strong&gt; — an intermediate language that no processor understands directly. Then the JVM reads that bytecode and executes it on your machine.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foabcgfpjdf6w43h62dxs.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Foabcgfpjdf6w43h62dxs.png" alt="Hello.java is compiled by javac into Hello.class bytecode, which the JVM then executes on Windows, macOS or Linux" width="800" height="356"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;That intermediate step is exactly what makes Java portable: the same &lt;code&gt;.class&lt;/code&gt; file runs on Windows, macOS and Linux, because each system has its own JVM. The famous "write once, run anywhere" comes from this design, not from magic.&lt;/p&gt;

&lt;p&gt;It also explains why you need the JDK and not just the JRE: without &lt;code&gt;javac&lt;/code&gt;, you can run other people's programs, but you cannot turn your own source code into something runnable.&lt;/p&gt;

&lt;h2&gt;
  
  
  Which version: understanding LTS
&lt;/h2&gt;

&lt;p&gt;Java releases a new version every six months. Most of them are superseded almost immediately. A few are designated &lt;strong&gt;LTS&lt;/strong&gt; (Long-Term Support) and receive security updates for years.&lt;/p&gt;

&lt;p&gt;&lt;a href="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg1cey5tbohwk4ggq5um.png" class="article-body-image-wrapper"&gt;&lt;img src="https://media2.dev.to/dynamic/image/width=800%2Cheight=%2Cfit=scale-down%2Cgravity=auto%2Cformat=auto/https%3A%2F%2Fdev-to-uploads.s3.us-east-2.amazonaws.com%2Fuploads%2Farticles%2Fkg1cey5tbohwk4ggq5um.png" alt="Timeline of Java LTS releases: 8 in 2014, 11 in 2018, 17 in 2021, 21 in 2023, 25 in 2025, 29 planned for 2027" width="800" height="320"&gt;&lt;/a&gt;&lt;/p&gt;

&lt;p&gt;The LTS releases are Java 8, 11, 17, 21 and 25. Java 25 arrived in September 2025, and Oracle now plans an LTS every two years, with Java 29 scheduled for September 2027.&lt;/p&gt;

&lt;p&gt;So which one should you install? &lt;strong&gt;Java 21&lt;/strong&gt;, for one specific reason: it is the version the current OCP exam (1Z0-830) is built on. If you're following this series to prepare for that exam, installing Java 25 means studying features the exam won't ask about and, worse, missing behaviour that changed between versions.&lt;/p&gt;

&lt;p&gt;If you're here only to learn Java and not for the certification, Java 25 is the better default.&lt;/p&gt;

&lt;h2&gt;
  
  
  The licensing trap nobody mentions
&lt;/h2&gt;

&lt;p&gt;Here's the part that makes most installation tutorials outdated.&lt;/p&gt;

&lt;p&gt;Oracle publishes its own JDK builds, and for a few years, Java 21 was distributed under a permissive licence that allowed free use including in production. &lt;strong&gt;That period ended in September 2026.&lt;/strong&gt; Update releases of Oracle JDK 21 published after that date moved to the Oracle Technology Network licence — the same one that covers Java 8, 11 and 17, which is free for personal and development use, but not for general commercial use.&lt;/p&gt;

&lt;p&gt;Oracle's own position is that users who want permissively licensed Java should move to JDK 25 or later.&lt;/p&gt;

&lt;p&gt;This puts anyone preparing the Java 21 exam in an awkward spot: you need Java 21, but Oracle's Java 21 is no longer the carefree download it used to be.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;The solution is simple, and it's what this series uses: install Eclipse Temurin.&lt;/strong&gt;&lt;/p&gt;

&lt;h2&gt;
  
  
  Why Temurin, and what all these distributions actually are
&lt;/h2&gt;

&lt;p&gt;Beginners are often confused by the number of Javas: Oracle JDK, Eclipse Temurin, Amazon Corretto, Azul Zulu, Microsoft Build of OpenJDK. It looks like a fragmented ecosystem. It isn't.&lt;/p&gt;

&lt;p&gt;They are all builds of &lt;strong&gt;the same source code&lt;/strong&gt; — the OpenJDK project. What differs is who compiles it, who tests it, who supports it, and under which licence it is distributed. A &lt;code&gt;.class&lt;/code&gt; file compiled with Temurin runs identically on Corretto.&lt;/p&gt;

&lt;p&gt;For this series, Temurin is the right choice: it's published by the Eclipse Foundation, it's free and open source with no licensing ambiguity, it's available for all three operating systems, and its Java 21 builds will keep receiving updates.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing on Linux
&lt;/h2&gt;

&lt;p&gt;On Ubuntu, the simplest route is the distribution's own package:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt update
sudo apt install openjdk-21-jdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you prefer Temurin's official builds, add the Adoptium repository first:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo apt install -y wget apt-transport-https gpg
wget -qO - https://packages.adoptium.net/artifactory/api/gpg/key/public &lt;span class="o"&gt;|&lt;/span&gt; gpg --dearmor &lt;span class="o"&gt;|&lt;/span&gt; sudo tee /etc/apt/trusted.gpg.d/adoptium.gpg &lt;span class="o"&gt;&amp;gt;&lt;/span&gt; /dev/null
&lt;span class="nb"&gt;echo&lt;/span&gt; &lt;span class="s2"&gt;"deb https://packages.adoptium.net/artifactory/deb $(awk -F= '/^VERSION_CODENAME/{print$2}' /etc/os-release) main"&lt;/span&gt; &lt;span class="o"&gt;|&lt;/span&gt; sudo tee /etc/apt/sources.list.d/adoptium.list
sudo apt update
sudo apt install temurin-21-jdk
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;If you end up with several JDKs installed, switch between them with:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;sudo update-alternatives --config java
sudo update-alternatives --config javac
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Note that &lt;code&gt;java&lt;/code&gt; and &lt;code&gt;javac&lt;/code&gt; are configured separately — forgetting the second one is a classic source of version mismatches.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing on macOS
&lt;/h2&gt;

&lt;p&gt;With Homebrew:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;brew install --cask temurin@21
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Without Homebrew, download the installer from &lt;a href="https://adoptium.net/temurin/releases/" rel="noopener noreferrer"&gt;adoptium.net/temurin/releases&lt;/a&gt;: select version 21 (LTS), macOS, and the right architecture — &lt;strong&gt;aarch64&lt;/strong&gt; for Apple Silicon (M1 and later), &lt;strong&gt;x64&lt;/strong&gt; for older Intel Macs. Picking the wrong architecture is the most common macOS mistake.&lt;/p&gt;

&lt;p&gt;To set &lt;code&gt;JAVA_HOME&lt;/code&gt;, add this to &lt;code&gt;~/.zshrc&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;&lt;span class="kd"&gt;export&lt;/span&gt; &lt;span class="nv"&gt;JAVA_HOME&lt;/span&gt;&lt;span class="o"&gt;=&lt;/span&gt;&lt;span class="nv"&gt;$(&lt;/span&gt;/usr/libexec/java_home -v 21&lt;span class="o"&gt;)&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;The &lt;code&gt;/usr/libexec/java_home&lt;/code&gt; utility is macOS-specific and resolves the path for you, which is more reliable than hardcoding it.&lt;/p&gt;

&lt;h2&gt;
  
  
  Installing on Windows
&lt;/h2&gt;

&lt;p&gt;Download the &lt;code&gt;.msi&lt;/code&gt; installer from &lt;a href="https://adoptium.net/temurin/releases/" rel="noopener noreferrer"&gt;adoptium.net/temurin/releases&lt;/a&gt;: version 21 (LTS), Windows, x64, JDK.&lt;/p&gt;

&lt;p&gt;During installation, one screen matters more than all the others. Make sure these options are enabled:&lt;/p&gt;

&lt;ul&gt;
&lt;li&gt;
&lt;strong&gt;Add to PATH&lt;/strong&gt; — so &lt;code&gt;java&lt;/code&gt; and &lt;code&gt;javac&lt;/code&gt; work from any terminal&lt;/li&gt;
&lt;li&gt;
&lt;strong&gt;Set JAVA_HOME variable&lt;/strong&gt; — required by Maven, Gradle and most build tools&lt;/li&gt;
&lt;/ul&gt;

&lt;p&gt;If you miss that screen, you'll get &lt;code&gt;javac is not recognized&lt;/code&gt; later. You can fix it afterwards through System Properties, Environment Variables, but enabling the checkboxes is far simpler.&lt;/p&gt;

&lt;p&gt;If you prefer the command line, winget works too:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;winget install EclipseAdoptium.Temurin.21.JDK
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;h2&gt;
  
  
  Verifying the installation
&lt;/h2&gt;

&lt;p&gt;Open a &lt;strong&gt;new&lt;/strong&gt; terminal — an already-open one won't see the updated &lt;code&gt;PATH&lt;/code&gt; — and run both commands:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight shell"&gt;&lt;code&gt;java --version
javac --version
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Both must answer, and both must show version 21. This is where the JRE-versus-JDK confusion surfaces: if &lt;code&gt;java&lt;/code&gt; answers but &lt;code&gt;javac&lt;/code&gt; says &lt;em&gt;command not found&lt;/em&gt;, you have a runtime but no compiler.&lt;/p&gt;

&lt;h2&gt;
  
  
  Your first program, without an IDE
&lt;/h2&gt;

&lt;p&gt;This series uses &lt;strong&gt;Vim on Ubuntu&lt;/strong&gt;, and the choice is deliberate rather than nostalgic. A modern IDE corrects, completes and hides: it underlines the error before you compile, offers a one-click fix, and sometimes rewrites the line for you. You end up with code that compiles without ever having seen &lt;strong&gt;why&lt;/strong&gt; the other version didn't. For exam preparation, that's exactly backwards.&lt;/p&gt;

&lt;p&gt;That said, use whatever you like — Notepad, Notepad++, Nano, VS Code, anything. What matters is that nothing fixes your code for you.&lt;/p&gt;

&lt;p&gt;Create a file called &lt;code&gt;Hello.java&lt;/code&gt;:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight java"&gt;&lt;code&gt;&lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;class&lt;/span&gt; &lt;span class="nc"&gt;Hello&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
    &lt;span class="k"&gt;public&lt;/span&gt; &lt;span class="k"&gt;static&lt;/span&gt; &lt;span class="kt"&gt;void&lt;/span&gt; &lt;span class="nf"&gt;main&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="kt"&gt;String&lt;/span&gt;&lt;span class="p"&gt;[&lt;/span&gt;&lt;span class="p"&gt;]&lt;/span&gt; &lt;span class="n"&gt;args&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt; &lt;span class="p"&gt;{&lt;/span&gt;
        &lt;span class="nc"&gt;System&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="k"&gt;out&lt;/span&gt;&lt;span class="p"&gt;.&lt;/span&gt;&lt;span class="nb"&gt;println&lt;/span&gt;&lt;span class="p"&gt;(&lt;/span&gt;&lt;span class="s2"&gt;"Hello from Java 21"&lt;/span&gt;&lt;span class="p"&gt;)&lt;/span&gt;&lt;span class="p"&gt;;&lt;/span&gt;
    &lt;span class="p"&gt;}&lt;/span&gt;
&lt;span class="p"&gt;}&lt;/span&gt;
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Then compile and run it:&lt;br&gt;
&lt;/p&gt;

&lt;div class="highlight js-code-highlight"&gt;
&lt;pre class="highlight plaintext"&gt;&lt;code&gt;javac Hello.java
java Hello
&lt;/code&gt;&lt;/pre&gt;

&lt;/div&gt;



&lt;p&gt;Notice what happened: &lt;code&gt;javac Hello.java&lt;/code&gt; produced a &lt;code&gt;Hello.class&lt;/code&gt; file next to your source, and &lt;code&gt;java Hello&lt;/code&gt; runs that class — &lt;strong&gt;without the extension&lt;/strong&gt;. Writing &lt;code&gt;java Hello.class&lt;/code&gt; is a classic beginner error. The &lt;code&gt;java&lt;/code&gt; command takes a class name, not a file name.&lt;/p&gt;

&lt;h2&gt;
  
  
  The five errors you'll actually hit
&lt;/h2&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;javac: command not found&lt;/code&gt;&lt;/strong&gt; — you installed a JRE instead of a JDK, or &lt;code&gt;PATH&lt;/code&gt; doesn't include the JDK's &lt;code&gt;bin&lt;/code&gt; directory. Check with &lt;code&gt;java --version&lt;/code&gt; first: if that works but &lt;code&gt;javac&lt;/code&gt; doesn't, it's almost certainly a JRE-only installation.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;java: command not found&lt;/code&gt;&lt;/strong&gt; — nothing is installed, or &lt;code&gt;PATH&lt;/code&gt; isn't set at all. On Windows, this usually means the "Add to PATH" box wasn't checked.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;class file has wrong version 65.0, should be 61.0&lt;/code&gt;&lt;/strong&gt; — you compiled with a newer JDK than the one running the code. Typically &lt;code&gt;javac&lt;/code&gt; points to Java 21 while &lt;code&gt;java&lt;/code&gt; points to Java 17. On Linux, fix it with &lt;code&gt;update-alternatives&lt;/code&gt; as shown above.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;error: class Hello is public, should be declared in a file named Hello.java&lt;/code&gt;&lt;/strong&gt; — your public class name doesn't match the file name. This rule has a real reason behind it, and it's the first thing the next article in this series covers.&lt;/p&gt;

&lt;p&gt;&lt;strong&gt;&lt;code&gt;Error: Could not find or load main class Hello&lt;/code&gt;&lt;/strong&gt; — you're either in the wrong directory, or you typed &lt;code&gt;java Hello.class&lt;/code&gt; instead of &lt;code&gt;java Hello&lt;/code&gt;.&lt;/p&gt;

&lt;h2&gt;
  
  
  What's next
&lt;/h2&gt;

&lt;p&gt;Your environment is ready. The next article starts the book itself, with the chapter everyone skims because it looks easy — and where almost everyone loses points: what a Java source file is actually allowed to contain, and why the &lt;code&gt;main&lt;/code&gt; method is far more permissive than you think.&lt;/p&gt;




&lt;p&gt;&lt;em&gt;I'm preparing the 1Z0-830 exam with the&lt;/em&gt; OCP Java SE 21 Developer Study Guide &lt;em&gt;(Sybex, Jeanne Boyarsky and Scott Selikoff). All explanations and code examples in this article are my own, verified on Ubuntu with JDK 21 and&lt;/em&gt; &lt;code&gt;javac&lt;/code&gt; &lt;em&gt;on the command line.&lt;/em&gt;&lt;/p&gt;

&lt;p&gt;&lt;em&gt;Written November 2026. Download links and version numbers change — if something no longer matches, tell me in the comments and I'll update the article.&lt;/em&gt;&lt;/p&gt;

</description>
      <category>java</category>
      <category>programming</category>
      <category>beginners</category>
      <category>tutorial</category>
    </item>
  </channel>
</rss>
