Skip to content

Java version management with Scoop

Scoop is a command-line installer for Windows. Its primary design philosophy is to install applications into the user's home directory, eliminating the need for administrator rights or UAC pop-ups during installation and removal.^[400-devops-02-os-and-linux-basics-windows-scoop.md] Because it does not automatically add programs to the system PATH, managing environment variables manually is often required unless handled via Shims.^[400-devops-02-os-and-linux-basics-windows-scoop.md]

Scoop organizes packages into collections called "buckets". To manage Java versions, one must first add the dedicated Java repository to the available buckets.^[400-devops-02-os-and-linux-basics-windows-scoop.md] This allows access to various distributions of the Java Development Kit (JDK).

Installation and Switching

Scoop allows for the simultaneous installation of multiple Java versions.^[400-devops-02-os-and-linux-basics-windows-scoop.md] To manage these versions, users use the scoop install command to download specific distributions (e.g., OpenJDK 11 or 17).^[400-devops-02-os-and-linux-basics-windows-scoop.md]

The key feature for version management is the scoop reset command.^[400-devops-02-os-and-linux-basics-windows-scoop.md] This command updates the symbolic links (Shims) to point the java command to a specific installed version, effectively switching the active Java runtime globally for the user.^[400-devops-02-os-and-linux-basics-windows-scoop.md]

Workflow

A typical workflow for setting up and switching Java versions involves three steps^[400-devops-02-os-and-linux-basics-windows-scoop.md]:

  1. Add the Java bucket: scoop bucket add java
  2. Install desired versions: scoop install openjdk17 (and others like openjdk11)
  3. Switch active version: scoop reset openjdk11

After switching, opening a new terminal session will reflect the change, which can be verified by checking the version.^[400-devops-02-os-and-linux-basics-windows-scoop.md]

Sources

^[400-devops-02-os-and-linux-basics-windows-scoop.md]

Scoop | [[Package Manager]] | Java | [[Environment Variables]]