Skip to content

Instantly share code, notes, and snippets.

@spearkkk
Last active February 15, 2022 02:47
Show Gist options
  • Save spearkkk/fe33601c0ec651872bef403501fc8d90 to your computer and use it in GitHub Desktop.
Save spearkkk/fe33601c0ec651872bef403501fc8d90 to your computer and use it in GitHub Desktop.
Usage `jenv` #fish #jenv

jEnv

jEnv is a command line tool to help you forget how to set JAVA_HOME environment variable.

Link

It sounds great! However, there is no usage for fish shell.

But I found this usage: https://github.com/jenv/jenv#1-getting-started
And there is usage for fish shell, but is not tested.

So I just want to use jEnv.

Usage

First install jEnv using brew.

brew install jenv

Set jEnv for fish

// vim: syntax=sh
echo 'set PATH $HOME/.jenv/bin $PATH' >> ~/.config/fish/config.fish
echo 'status --is-interactive; and source (jenv init -|psub)' >> ~/.config/fish/config.fish
cp ~/.jenv/fish/jenv.fish ~/.config/fish/function/jenv.fish
cp ~/.jenv/fish/export.fish ~/.config/fish/function/export.fish

If there is no 'jenv.fish' and 'export.fish' file in ~/.jenv/fish, you can find it in /usr/local/Cellar/jenv/0.5.2/libexec/fish.
Maybe the version value is not fit this but I think you can guess it.

And then just install jdk.
I installed JDK for 8, 10 using brew. Refer to this link.

Finally, you can add version for jenv.

jenv add (/usr/libexec/java_home) or jenv add PATH_YOUR_JDK

Reference

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment