Hacker News new | ask | show | jobs
by rimmontrieu 209 days ago
The advantage of using a package manager like scoop or chocolatey is that you have a unified interface to manage multiple versions of JDK, and you can switch the default version system-wide on the fly, regardless of your IDE:

  scoop bucket add java

  # Install JDK 11
  scoop install java/temurin11-jdk
  # Install JDK 17
  scoop install java/temurin17-jdk
  # Use JDK 11
  scoop reset temurin11-jdk
  # Use JDK 17
  scoop reset temurin17-jdk
I also wrote a short guide on my website: https://raizensoft.com/tutorial/install-java-gamedev/
1 comments

Thanks, but what does “the default version system-wide” mean, other than setting environment variables or replacing the JDK in a fixed location?
You can do that manually but it's tedious if you want to use multiple JDKs. Assuming you want to test two apps outside of an IDE, one only supports Java 8 API, and the other supports Java 21 API, you don't want to edit JAVA_HOME every time you switch back and forth between the two apps.

With scoop you can just launch the terminal and run `scoop reset [java-version]`