SDKMAN 5.5.9+231 says package is not a valid candidate on MacOS
Asked Answered
A

4

15

I have no idea why this started happening, but my SDKMAN stopped working and only displays the following message for whatever package I want to list, install, or use.

$ sdk list java

Stop! java is not a valid candidate.

$ sdk install java

Stop! java is not a valid candidate.

$ sdk use java 8u131

Stop! java is not a valid candidate.

Just typing sdk list works, though. But I can't do anything. My .bash_profile contains the following:

export JAVA_HOME=$(/usr/libexec/java_home)

export SDKMAN_DIR="/Users/myusername/.sdkman"
[[ -s "/Users/myusername/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/myusername/.sdkman/bin/sdkman-init.sh"
Angele answered 12/6, 2017 at 19:34 Comment(1)
An issue has been raised in SDKMAN's GitHub repository: github.com/sdkman/sdkman-cli/issues/587Angele
A
14

The problem was on the server side. Something to do with SDKMAN's Candidates API. As pointed out in the GitHub issue, you can get over the problem using the following command:

sdk flush candidates

Make sure to restart your terminal after that.

Angele answered 23/6, 2017 at 23:42 Comment(0)
K
31

Also double check if you put the target sdk in front of the version. This won't work:

sdk install 9.0.4-openjdk

Stop! 9.0.4-openjdk is not a valid candidate.

Specifying it correctly works:

sdk install java 9.0.4-openjdk
Knead answered 25/4, 2018 at 8:46 Comment(0)
A
14

The problem was on the server side. Something to do with SDKMAN's Candidates API. As pointed out in the GitHub issue, you can get over the problem using the following command:

sdk flush candidates

Make sure to restart your terminal after that.

Angele answered 23/6, 2017 at 23:42 Comment(0)
G
0

Faced the same issue today. I was getting the same message after using sdk flush candidates and restarting the terminal.

So had to run sdk update and then restart the terminal. This added the candidates back.

Giacinta answered 15/2, 2023 at 13:22 Comment(2)
Does this add value over nbkhope's accepted answer?Miscalculate
@Miscalculate Yes it does. I could solve the issue after following steps mentioned in nbkhope's answer. So my second line mentions what extra steps i did to resolve itGiacinta
S
0

My problem was that the following export

export SDKMAN_DIR="$HOME/.sdkman"
[[ -s "$HOME/.sdkman/bin/sdkman-init.sh" ]] && source "$HOME/.sdkman/bin/sdkman-init.sh

was not at the bottom of ~/.bashrc file. It happened because I installed the other tools which ended up at the bottom of ~/.bashrc.

When I moved it to the bottom and restarted the terminal sdk started to work.

Spurtle answered 23/2, 2023 at 8:28 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.