Search

Dark theme | Light theme

July 4, 2022

Get Absolute Path To An SDK With SDKMAN!

SDKMAN! has a home command that will return the absolute path of any SDK we pass as argument. This can be usefull in scripts where we need the absolute path to a SDK. We can specify the name of the SDK after the home command and the version. To use the current version that is set as default we can use as version current.

In the following example we use the home command for several SDKs:

$ sdk home groovy 4.0.3
/Users/mrhaki/.sdkman/candidates/groovy/4.0.3%
$ sdk home java 17.0.3-tem
/Users/mrhaki/.sdkman/candidates/java/17.0.3-tem%
$ sdk home jbake current
/Users/mrhaki/.sdkman/candidates/jbake/current%
$ export ASCIIDOCTORJ_DIR=`sdk home asciidoctorj current`
$ echo $ASCIIDOCTOR_DIR
/Users/mrhaki/.sdkman/candidates/asciidoctorj/current
$

Written with SDKMAN! 5.15.0.