Comment by rimmontrieu

2 months ago

+1 sdkman! is awesome. I've been using sdkman! for a decade to manage Java installations. Doesn't seem to work on freebsd though, which I have to use freebsd's pkg instead.

On Windows, the only sane way to install Java seems to be scoop.sh or chocolatey

JDKs are just a directory tree. Not sure what you mean on Windows, you simply unpack the JDKs to whatever directories you want, and set PATH and/or JAVA_HOME according to which you want to use, and/or switch them in your IDE.

  • 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/

    • Thanks, but what does “the default version system-wide” mean, other than setting environment variables or replacing the JDK in a fixed location?

      1 reply →