Explain Codes LogoExplain Codes Logo

How can I get the latest JRE / JDK as a zip file rather than EXE or MSI installer?

java
prompt-engineering
environment-variables
portability
Nikita BarsukovbyNikita Barsukov·Dec 11, 2024
TLDR

Fetch the JDK in a zip format via a tar.gz archive from:

  • Oracle (personal use):

    • Navigate to https://www.oracle.com/java/technologies/javase-downloads.html
    • Opt for .tar.gz corresponding to the chosen version
    • Extract using tar -xzf jdk-version.tar.gz
  • AdoptOpenJDK (open-source route):

    • Head to https://adoptopenjdk.net/
    • Select version, then .tar.gz
    • Unpack with your preferred archive tool

Extraction on Windows using 7-Zip:

7z x jdk-version.tar.gz -oJDK_FOLDER //The magic incantation

The workaround: Installing JDK without the traditional installer

Running into permissions hurdle or require a portable solution? Here's the manual route to setup JDK with the power of zip files and environment manipulation.

Breaking the shackles of traditional installers

Installers are not your only option. Extract the archive, set a couple of environment variables and you're good to go! Here's the step-by-step guide:

  1. Fetch the .exe or .msi package from Oracle's site.
  2. Unpack the bounty:
    • For .exe, use 7-Zip: Right-click on the file > 7-Zip > Extract to "jdk-XuXX-windows-x64".
    • For .msi, venture into C:\Users\YOUR_USER_NAME\AppData\LocalLow\Sun\Java where MSI and CAB files normally hide.
    • Stumbling upon JDK 8? Seek the tools.zip file.
  3. Move the extracted riches to your JDK directory.
  4. Set JAVA_HOME and PATH environment variables pointing to your new JDK abode.

Custom solutions: Every JDK problem has a tailored answer

Whether you need a JDK that's always ready for travel, or setting up a Java environment without admin rights, here are your knight(s) in shiny armour:

  • Universal Extractor: If JRE or JDK, an worthy alternative to 7-Zip when dealing with stubborn MSI files.
  • PortableApps.com: They keep portable versions of JDK and JRE, handy right?
  • jdk.java.net: The Holy Grail, the home of official OpenJDK builds. Perfect if you love everything open-source.

An in-depth dive into JDK portability

Let's delve deeper into the caverns of JDK portability. A handful of must-knows await.

Leaving no traces, the Spy way

Portable JDK is the spy's tool – leaves no registry changes. Important when you play hot potato with systems, leaving no traces.

Customize, because who doesn't love it?

JDK isn't rigid, mold it with jlink, letting you create a custom JRE. Perfect for creating lean applications, cutting the fat!

Flexibility for the nomadic coder

This portable approach offers you the flexibility to configure Java on USB drives, cloud storage, or shared network locations. Wander freely.

When X marks the MSI and CAB spot

Venture into C:\Users\YOUR_USER_NAME\AppData\LocalLow\Sun\Java – the promised land of MSI and CAB files, visible after initiating an Oracle JDK download.

Quitters aren't always Losers

Start the Java installer but quitonce the temporary files materialise, avoiding a wasteful full installation. Yes, quitting can also win you the game!