If you are a developer, working mainly with Java, you will notice that so many things need to be done in order to install and stay updated with Java ecosystem and development tools. There’s a tool called SDKMAN! which can be used to handle installation, configuration, remove, and update all those Java-base software easier. It can be used on major platform (Linux, Windows, Mac) and makes our live as (Java platform) developer easier. However, it doesn’t include support for Fish Shell (yet). So, if you are Linux user and a happy Fish user, stay tuned for a guide to install and configure SDKMAN! for Fish.
First, we need to install SDKMAN!. For this, we don’t care what shell we use. Do this:
$ curl -s "https://get.sdkman.io" | bash
-+syyyyyyys:
`/yho:` -yd.
`/yh/` +m.
.oho. hy .`
.sh/` :N` `-/o` `+dyyo:.
.yh:` `M- `-/osysoym :hs` `-+sys: hhyssssssssy+
.sh:` `N: ms/-`` yy.yh- -hy. `.N-````````+N.
`od/` `N- -/oM- ddd+` `sd: hNNm -N:
:do` .M. dMMM- `ms. /d+` `NMMs `do
.yy- :N` ```mMMM. - -hy. /MMM: yh
`+d+` `:/oo/` `-/osyh/ossssssdNMM` .sh: yMMN` /m.
-dh- :ymNMMMMy `-/shmNm-`:N/-.`` `.sN /N- `NMMy .m/
`oNs` -hysosmMMMMydmNmds+-.:ohm : sd` :MMM/ yy
.hN+ /d: -MMMmhs/-.` .MMMh .ss+- `yy` sMMN` :N.
:mN/ `N/ `o/-` :MMMo +MMMN- .` `ds mMMh do
/NN/ `N+....--:/+oooosooo+:sMMM: hMMMM: `my .m+ -MMM+ :N.
/NMo -+ooooo+/:-....`...:+hNMN. `NMMMd` .MM/ -m: oMMN. hs
-NMd` :mm -MMMm- .s/ -MMm. /m- mMMd -N.
`mMM/ .- /MMh. -dMo -MMMy od. .MMMs..---yh
+MMM. sNo`.sNMM+ :MMMM/ sh`+MMMNmNm+++-
mMMM- /--ohmMMM+ :MMMMm. `hyymmmdddo
MMMMh. ```` `-+yy/`yMMM/ :MMMMMy -sm:.``..-:-.`
dMMMMmo-.``````..-:/osyhddddho. `+shdh+. hMMM: :MmMMMM/ ./yy/` `:sys+/+sh/
.dMMMMMMmdddddmmNMMMNNNNNMMMMMs sNdo- dMMM- `-/yd/MMMMm-:sy+. :hs- /N`
`/ymNNNNNNNmmdys+/::----/dMMm: +m- mMMM+ohmo/.` sMMMMdo- .om: `sh
`.-----+/.` `.-+hh/` `od. NMMNmds/ `mmy:` +mMy `:yy.
/moyso+//+ossso:. .yy` `dy+:` .. :MMMN+---/oys:
/+m: `.-:::-` /d+ +MMMMMMMNh:`
+MN/ -yh. `+hddhy+.
/MM+ .sh:
:NMo -sh/
-NMs `/yy:
.NMy `:sh+.
`mMm` ./yds-
`dMMMmyo:-.````.-:oymNy:`
+NMMMMMMMMMMMMMMMMms:`
-+shmNMMMNmdy+:`
Now attempting installation...
Looking for a previous installation of SDKMAN...
Looking for unzip...
Looking for zip...
Looking for curl...
Looking for sed...
Installing SDKMAN scripts...
Create distribution directories...
Getting available candidates...
Prime platform file...
Prime the config file...
Installing script cli archive...
* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...
Installing script cli archive...
* Downloading...
######################################################################## 100.0%
* Checking archive integrity...
* Extracting archive...
* Copying archive contents...
* Cleaning up...
Set version to 5.18.2 ...
Set native version to 0.2.9 ...
Attempt update of interactive bash profile on regular UNIX...
Attempt update of zsh profile...
Updated existing /home/bpdp/.zshrc
All done!
You are subscribed to the STABLE channel.
Please open a new terminal, or run the following in the existing one:
source "/home/bpdp/.sdkman/bin/sdkman-init.sh"
Then issue the following command:
sdk help
Enjoy!!!
Notes: Your path of course different with mine. Also, if you use Bash or Zsh, you may now use SDKMAN!. If you use Fish, please continue.
Now, install Fisher first:
$ curl -sL https://raw.githubusercontent.com/jorgebucaran/fisher/main/functions/fisher.fish | source && fisher install jorgebucaran/fisher
fisher install version 4.4.3
Fetching https://api.github.com/repos/jorgebucaran/fisher/tarball/HEAD
Installing jorgebucaran/fisher
/home/bpdp/.config/fish/functions/fisher.fish
/home/bpdp/.config/fish/completions/fisher.fish
Updated 1 plugin/s
$ fisher list
jorgebucaran/fisher
$
Using fisher, let’s install SDKMAN! for Fish:
fisher install reitzig/sdkman-for-fish@v2.0.0
fisher install version 4.4.3
Fetching https://api.github.com/repos/reitzig/sdkman-for-fish/tarball/v2.0.0
Installing reitzig/sdkman-for-fish@v2.0.0
/home/bpdp/.config/fish/functions/sdk.fish
/home/bpdp/.config/fish/conf.d/sdk.fish
/home/bpdp/.config/fish/completions/sdk.fish
Updated 1 plugin/s
$ fisher list
jorgebucaran/fisher
reitzig/sdkman-for-fish@v2.0.0
$
Configure SDKMAN! directory in $HOME/.config/fish/conf.d/config_sdk.fish, add this text:
set -g __sdkman_custom_dir $HOME/.sdkman
Exit from current terminal/shell, then activate new terminal/shell. Run sdk:
$ sdk
NAME
sdk - The command line interface (CLI) for SDKMAN!
SYNOPSIS
sdk <subcommand> [candidate] [version]
DESCRIPTION
SDKMAN! is a tool for managing parallel versions of multiple JVM related
Software Development Kits on most Unix based systems. It provides a
convenient Command Line Interface (CLI) and API for installing, switching,
removing and listing Candidates.
SUBCOMMANDS & QUALIFIERS
help [subcommand]
install <candidate> [version] [path]
uninstall <candidate> <version>
list [candidate]
use <candidate> <version>
config no qualifier
default <candidate> [version]
home <candidate> <version>
env [init|install|clear]
current [candidate]
upgrade [candidate]
version no qualifier
offline [enable|disable]
selfupdate [force]
update no qualifier
flush [tmp|metadata|version]
EXAMPLES
sdk install java 17.0.0-tem
sdk help install
$
All are set!