Java

Choice of JDKs

Java development kits (JDK) and runtime environments (JRE) are available through the Scoop Java bucket.

To add the bucket, run scoop bucket add java

OpenJDK is the preferred JDK (because of its Open Source license), and can be installed with scoop install openjdk. The Scoop Java bucket contains four different OpenJDK builds: OpenJDK, Zulu, ojdkbuild and AdoptOpenJDK. The latter with both Hotspot and OpenJ9 JVMs.

Oracle’s Java is also available, in two versions: JDK, JDK-LTS. The JDK-LTS version follows Oracle's new LTS releases (available since version 11).

Switching Javas

There are two solutions available today for switching java:

  1. scoop reset <java>[@<version>]
  2. Using find-java from extras

scoop reset works very well for the current session, and will also update the user's path.

Globally installed javas takes precedence over user installed javas, so running sudo scoop install -g oraclejdk-lts will install a java that is always default for new sessions.

Consider the following:

scoop install oraclejdk-lts
# Installing 'oraclejdk-lts' (8u172-b11) [64bit]
scoop install oraclejdk10
# Installing 'oraclejdk10' (10.0.1-10) [64bit]
scoop install zulu6
# Installing 'zulu6' (6.18.1.5) [64bit]
scoop install openjdk10
# Installing 'openjdk10' (10.0.1) [64bit]
java -version
# openjdk version "10.0.1" 2018-04-17
# OpenJDK Runtime Environment (build 10.0.1+10)
# OpenJDK 64-Bit Server VM (build 10.0.1+10, mixed mode)
scoop reset zulu6
# Resetting zulu6 (6.18.1.5).
# Linking ~\scoop\apps\zulu6\current => ~\scoop\apps\zulu6\6.18.1.5
java -version
# openjdk version "1.6.0-99"
# OpenJDK Runtime Environment (Zulu 6.18.1.5-win64) (build 1.6.0-99-b99)
# OpenJDK 64-Bit Server VM (Zulu 6.18.1.5-win64) (build 23.77-b99, mixed mode)
scoop reset oraclejdk-lts
java -version
# java version "1.8.0_172"
# Java(TM) SE Runtime Environment (build 1.8.0_172-b11)
# Java HotSpot(TM) 64-Bit Server VM (build 25.172-b11, mixed mode)
Last Updated: 10/23/2018, 8:43:08 AM