Java Installation made easy
With java releasing a new version every six months it has been quite tricky to get your hands dirty and try out new feature. As every time you will need to search for various versions, download them, extract them and then fight an ever confusing battle with bash profile to point JAVA_HOME to the desired version.
Add to the misery, once you are done experimenting you will again go back and forth to rollback it to the verison with which your applications have been running until now. Well if you also have faced these annoying issues this article is for you.
SDKMAN to the rescue!!
What is that??
“SDKMAN! is a tool for managing parallel versions of multiple Software Development Kits on most Unix based systems” — sdkman
Home - SDKMAN! the Software Development Kit Manager
Making life easier. No more trawling download pages, extracting archives, messing with _HOME and PATH environment…
curl -s "https://get.sdkman.io" | bashsource "$HOME/.sdkman/bin/sdkman-init.sh"sdk version
This should provide you the version of SDKMAN installed. Once the installation is done you’re ready to install your desired java version.
Now that we have the sdkman set up, we are ready to install the latest java version.
To find out versions available run
sdk list java
Now install the desired version(say Amazon’s corretto) using
sdk install java 8.282.08.1-amzn
Temporarily switch to a different version using (note this is only for this particular shell session)
sdk use java <java-version>
Permanently switch to a different java version
To uninstall a particular java version use
sdk uninstall java 8.282.08.1-amzn