Gili
Gili

Reputation: 90150

How to install OpenJDK 11 on Windows?

In the past, Oracle used to publish an executable installers for Windows that would:

As of Java 11, the Oracle's free version of Java (Oracle OpenJDK) doesn't seem to include an installer. It is just a zip file containing the binaries.

How are we supposed to install OpenJDK 11 on Windows seeing as the aforementioned integrations are no longer there? Aren't they necessary?

Upvotes: 436

Views: 653537

Answers (12)

Pimgd
Pimgd

Reputation: 6043

Eclipse Adoptium

For Java 17 and up, you can use the Eclipse Adoptium website. According to their about section, the Eclipse Adoptium project is the continuation of the original AdoptOpenJDK mission. It currently hosts Java 8, 11 and 16 through 22, offering various installation methods, including .msi installers, which will perform all the things listed in the question (Unpacking, registry keys, PATH variable updating (and JAVA_HOME), uninstaller...).

Earlier, Java 11 was hosted via AdoptOpenJDK. It now redirects to Eclipse Adoptium.

Upvotes: 283

Swapnil
Swapnil

Reputation: 1134

JDK builds

Basically, there is only one set of source code for the JDK. It is hosted in Mercurial at OpenJDK. Anyone can take the source code, produce a build, and post it. So, Oracle created a certification process that should be used to ensure the build is valid. This certification is run by the Java Community Process, which provides a Technology Compatibility Kit (TCK or JCK as Java). If an organization produces an OpenJDK build that passes the TCK then that build can be described as “Java SE compatible”.

Eclipse Temurin
AdoptOpenJDK has been moved to the Eclipse Foundation and rebranded to Eclipse Adoptium project. The Adoptium OpenJDK builds are called Eclipse Temurin to distinguish the project from the builds. Eclipse Temurin builds are high-quality, vendor-neutral, and TCK-tested under a permissive license. Temurin is available for a wide range of platforms and Java SE versions.

Zulu
You can check Zulu from Azul. Azul provides open source OpenJDK builds called Azul Zulu for many operating systems and architectures. Azul Platform Core provides 100% open source, fully tested and certified, Java SE standards-compliant, well-curated builds of OpenJDK. Zulu is compliant with Java SE specifications, and has an identical level of performance to the Oracle offering, making it an easy “drop-in” replacement for Oracle HotSpot.

Amazon Corretto
You can also use Amazon Corretto. It is free to use multiplatform, production-ready distribution of the OpenJDK. It comes with long-term support that will include performance enhancements and security fixes. Check the installation instructions here.

TCK Compliant
One more thing I like to highlight here is that all the mentions builds are TCK Compliant. You can see the OpenJDK builds comparison here and here.

Check this guide to decide which jdk suits best for your needs.

Upvotes: 5

Bernhard Stadler
Bernhard Stadler

Reputation: 2383

For Java 12 onwards, official General-Availability (GA) and Early-Access (EA) Windows 64-bit builds of the OpenJDK (GPL2 + Classpath Exception) from Oracle are available as tar.gz/zip from the JDK website.

If you prefer an installer, there are several distributions. There is a public Google Doc and Blog post by the Java Champions community which lists the best-supported OpenJDK distributions. Currently, these are:

Upvotes: 3

d3r3kk
d3r3kk

Reputation: 4065

WinGet is now available on Windows 10+ to install the Microsoft Build of OpenJDK on your machine. See details and access the downloads page at https://aka.ms/msopenjdk/ where you can find more instructions and packages you may find useful.

Upvotes: 1

Nabeel Ali
Nabeel Ali

Reputation: 74

Try this also. choco install -y microsoft-openjdk11

Upvotes: 0

jfk
jfk

Reputation: 5307

Scoop installs programs you know and love, from the command line with a minimal amount of friction.

  • Install scoop
  • Add java scoop bucket add java
  • Install OpenJDK scoop.cmd install openjdk17

Upvotes: 5

Engr.Aftab Ufaq
Engr.Aftab Ufaq

Reputation: 6394

Here is the complete answer. first of all you have to install the Chocolatey. to install Chocolatey run powershell as administrator and run the following command

Set-ExecutionPolicy Bypass -Scope Process -Force; [System.Net.ServicePointManager]::SecurityProtocol = [System.Net.ServicePointManager]::SecurityProtocol -bor 3072; iex ((New-Object System.Net.WebClient).DownloadString('https://community.chocolatey.org/install.ps1'))

after this run open cmd as administrator and run this command

choco install -y openjdk11

it will install the openjdk to the following location

C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot

finllay set your JAVA_HOME TO

C:\Program Files\Eclipse Adoptium\jdk-11.0.16.101-hotspot

and cheers

Upvotes: 0

Prince
Prince

Reputation: 20882

In addition to the above answers, it is worth noting that you have to move your JDK Path entry to the top of the Path

Inside System Variables Edit Path and Move Up the latest JDK entry to the top

Upvotes: 2

Tobias
Tobias

Reputation: 2139

Use the Chocolatey packet manager. It's a command-line tool similar to npm. Once you have installed it, use

choco install openjdk --version=11.0

in an elevated command prompt to install OpenJDK 11 (leave out the --version parameter to install the latest version).

To update an installed version to the latest version, type

choco upgrade openjdk

Pretty simple to use and especially helpful to upgrade to the latest version. No manual fiddling with path environment variables.

Upvotes: 43

David Airapetyan
David Airapetyan

Reputation: 5620

https://www.openlogic.com/openjdk-downloads allowed me to pick a 32-bit version of OpenJDK8 (don't ask - Arduino IDE doesn't compile with 11), I think they just wrap around AdoptOpenJDK MSIs but I couldn't find 32-bit distros on AdoptOpenJDK.

Upvotes: 1

Lior Bar-On
Lior Bar-On

Reputation: 11520

  1. Extract the zip file into a folder, e.g. C:\Program Files\Java\ and it will create a jdk-11 folder (where the bin folder is a direct sub-folder). You may need Administrator privileges to extract the zip file to this location.

  2. Set a PATH:

    • Select Control Panel and then System.
    • Click Advanced and then Environment Variables.
    • Add the location of the bin folder of the JDK installation to the PATH variable in System Variables.
    • The following is a typical value for the PATH variable: C:\WINDOWS\system32;C:\WINDOWS;"C:\Program Files\Java\jdk-11\bin"
  3. Set JAVA_HOME:

    • Under System Variables, click New.
    • Enter the variable name as JAVA_HOME.
    • Enter the variable value as the installation path of the JDK (without the bin sub-folder).
    • Click OK.
    • Click Apply Changes.
  4. Configure the JDK in your IDE (e.g. IntelliJ or Eclipse).

You are set.

To see if it worked, open up the Command Prompt and type java -version and see if it prints your newly installed JDK.

If you want to uninstall - just undo the above steps.

Note: You can also point JAVA_HOME to the folder of your JDK installations and then set the PATH variable to %JAVA_HOME%\bin. So when you want to change the JDK you change only the JAVA_HOME variable and leave PATH as it is.

Upvotes: 602

Martin Schröder
Martin Schröder

Reputation: 4591

From the comment by @ZhekaKozlov: ojdkbuild has OpenJDK builds (currently 8 and 11) for Windows (zip and msi).

Upvotes: 24

Related Questions