1

java --version command is not working after setting the version using jenv.

➜  ~ java --version
Usage: java [options] <mainclass> [args...]
           (to execute a class)
   or  java [options] -jar <jarfile> [args...]
           (to execute a jar file)
   or  java [options] -m <module>[/<mainclass>] [args...]
       java [options] --module <module>[/<mainclass>] [args...]
           (to execute the main class in a module)
   or  java [options] <sourcefile> [args]
           (to execute a single source-file program)
...
...

Below is the output I am getting for the usual jenv commands.

output of jenv doctor

➜  ~ jenv doctor
[OK]    JAVA_HOME variable probably set by jenv PROMPT
[OK]    Java binaries in path are jenv shims
[OK]    Jenv is correctly loaded

output of cat ~/.zshrc | grep jenv

➜  ~ cat ~/.zshrc | grep jenv
## Initializations for jenv
export PATH="$HOME/.jenv/bin:$PATH"
eval "$(jenv init -)"
export JAVA_HOME="$(jenv prefix)"

the output of some of the other commands that are usually used to understand the jenv environment

➜  ~ eval "$(jenv init -)"
➜  ~
➜  ~ jenv enable-plugin export
export plugin already enabled
➜  ~ jenv version
system (set by /Users/my_username/.jenv/version)

This has been incredibly frustrating. Any help would be appreciated. I have tried restarting my machine, reinstalling jenv etc., but no luck.

I have reinstalled jenv, tried restarting my machine, and tried to change the java version using jenv global version. No luck.

500865
  • 6,920
  • 7
  • 44
  • 87

0 Answers0