Abacus
Abacus

Reputation: 19471

Can I install a previous version of a JDK with sdkman?

sdkman lists the current Corretto JDK version (8.282.08.1-amzn) and I can install that. Is it possible to install a previous version (8.275.01.1) with sdkman as well? If so, how can I list the previous versions available?

Upvotes: 8

Views: 7291

Answers (3)

jvacaq
jvacaq

Reputation: 1539

As the offical documentation says:https://sdkman.io/usage

Install Local Version(s) Using a snapshot version? Already have a local installation? Setup a local version by specifying the path to the local installation:

So, download the java version you need, set it up on your system an then run:

sdk install java localname /path/to/jvm/you/just/installed

sdk install java 17-zulu /Library/Java/JavaVirtualMachines/zulu-17.jdk/Contents/Home

Sdk lets you use it.

Upvotes: 0

bmaupin
bmaupin

Reputation: 16015

Following up on JSamir's answer and the answer they linked, here's what I did specifically to install an older version of Azul Zulu (I prefer it to Corretto because they provide non-LTS versions and optionally bundle JavaFX, but adjust these instructions as needed):

  1. Download the version of Java you'd like to install

  2. Extract to ~/.sdkman/candidates/java/, e.g.

    tar xvf zulu8.40.0.25-ca-jdk8.0.222-linux_x64.tar.gz
    mv zulu8.40.0.25-ca-jdk8.0.222-linux_x64 ~/.sdkman/candidates/java/8.0.222-zulu
    
  3. Tell SDKMAN to use the version you downloaded

    • Just this shell

      sdk use java 8.0.222-zulu
      
    • Use it as the default for all shells

      sdk default java 8.0.222-zulu
      

Upvotes: 6

JSamir
JSamir

Reputation: 1225

With the work within this issue, the base for such a feature is there: https://github.com/sdkman/sdkman-db-migrations/issues/170

But it is not implemented yet, e.g. there are no commands for the sdkman cli to install older versions.

Until such a feature is implemented, I would manually download older versions and install them locally. Afterwards, you can switch to this version with the sdkman commands as if that version was installed with sdkman. For details see https://stackoverflow.com/a/60346121/1189810

Upvotes: 0

Related Questions