SDKMAN doesn't show current Java-Version

92 views Asked by At

I need to work with Java 17 and 21 and therefore installed SDKMAN to be able to easily switch between versions. Everything works fine except that sdk current java says

Not using any version of java

I installed both Java versions with SDKMAN. sdk use java and sdk default java work fine. When I run java -version the correct version is shown.

However what I find suspicious is that no Java-Version is mentioned in my Path-Variable. Does SDKMAN usually modify the Path-Variable and it's just not working on my machine or is this normal?

1

There are 1 answers

1
Stephen C On

SDKMAN does its magic by changing symlinks in your system's standard "bin" directories, not by updating your environment variables. Your PATH variable doesn't need to change1.

For the record, the "alternatives" tools provided by many Linux distros works the same way.

In short, be happy. All is well.


1 - This is a good thing. On UNIX, Linux and (I think) MacOS, a command can only directly change environment variables for itself, and when launching a child process. It can't even change the environment variables for the shell that was used to run it. Making an environment variable change "stick" would be gnarly. You would need to update update shell initialization files, and so on.