SDK Manager installs and manages multiple versions od JDKs .
Originally it was just for JDK languages and their main build systems, but has in recent years extended to a wider list of support technologies:
- JDK languages - Java, Groovy, Scala, Kotlin
- JDK related build systems - Maven, Gradle, SBT, Ant
- JDK based frameworks - Grails, Spring Boot, JBang
- JDK based products - Hadoop, Spark, Flink, ActiveMQ, Tomcat, JMeter, VisualVM etc.
curl -s "https://get.sdkman.io" | bash
Add SDKman to $PATH
:
source "$HOME/.sdkman/bin/sdkman-init.sh"
Will usually add something like this to the end of your $HOME/.bash_profile
login profile script:
#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!
export SDKMAN_DIR="/Users/hari/.sdkman"
[[ -s "/Users/hari/.sdkman/bin/sdkman-init.sh" ]] && source "/Users/hari/.sdkman/bin/sdkman-init.sh"
Future shells will then automatically call /Users/hari/.sdkman/bin/sdkman-init.sh
to add paths like this:
/Users/hari/.sdkman/candidates/scala/current/bin
/Users/hari/.sdkman/candidates/sbt/current/bin
/Users/hari/.sdkman/candidates/maven/current/bin
/Users/hari/.sdkman/candidates/java/current/bin
/Users/hari/.sdkman/candidates/groovy/current/bin
/Users/hari/.sdkman/candidates/gradle/current/bin
early in your $PATH
list to default to using whatever version of each SDK SDKman has installed and switched to
internally via symlinks in each case to:
/Users/hari/.sdkman/candidates/<name>/<version>
and are atomically switched to different versions by the sdk use
command.
Show list of commands:
sdk help
sdk update
sdk list
(or sdk ls
)
sdk list java
sdk install java
(can also shorten to sdk i java
)
sdk install java <version>
sdk use java <version>
sdk current
(or sdk c
)
Output:
Using:
gradle: 7.3.3
groovy: 4.0.0
java: 21.0.4-tem
jbang: 0.119.0
maven: 3.8.4
pomchecker: 1.13.0
sbt: 1.6.2
scala: 3.1.1
visualvm: 2.1.10
sdk current java
Output:
Using java version 21.0.4-tem
sdk rm java 21.0.4-tem
Deselecting java 21.0.4-tem...
Uninstalling java 21.0.4-tem...
sdk flush
Output:
9 archive(s) flushed, freeing 619M /Users/hari/.sdkman/archives.
20 archive(s) flushed, freeing 104K /Users/hari/.sdkman/tmp.
9 archive(s) flushed, freeing 48K /Users/hari/.sdkman/var/metadata.