This problem persisted after updating and upgrading sdkman, deleting .sdkman and reinstalling it, and uninstalling java packages and reinstalling them.
me@myMachine myProject $ sdk default java 8.0.252.hs-adpt
Default java version set to 8.0.252.hs-adpt
me@myMachine myProject $ sdk default java
Default java version set to 11.0.7.hs-adpt
sdk current java
and java -version
reflect the change but reverts back to 11.0.7 upon closing and reopening terminal, or opening a different window or app.
sdkman
so I needed to uninstall withbrew uninstall java
first and then immediately afterwards,java -version
andwhich java
was correctly showing the Java version fromsdkman
. Thanks. – Flacon