Last active
April 23, 2022 09:30
-
-
Save speedlog/c96ed2c40588c0482ea7123a5ae2f241 to your computer and use it in GitHub Desktop.
Alias for use any patch and distribution of specific java version (using sdkman)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Alias for use any patch and distribution of specific java version (using sdkman) | |
# usage sdkj 17 | |
# Source: https://gist.github.com/speedlog/c96ed2c40588c0482ea7123a5ae2f241 | |
alias sdkj='_sdkman_use_any_java(){ java_sdkman=$(find ~/.sdkman/candidates/java -mindepth 1 -maxdepth 1 -type d -printf "%f\n" | grep "^$1" | sort -r | head -n1) && if [[ -z $java_sdkman ]]; then echo "Cant find java $1 installed by sdkman"; return; fi && source "$HOME/.sdkman/bin/sdkman-init.sh" && sdk use java $java_sdkman; }; _sdkman_use_any_java' |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Script for install alias in bash