Open edmondop opened 4 years ago
Hi @edmondo1984, have you tried opening a new terminal and tried using the command again? Is this happening for all commands depending on Java? Anything else off significance?
In future, please use the provided template (the good stuff you deleted) when submitting bug reports, otherwise we simply don't have enough to go on and can't help.
I'm having the same or very similar issue on archlinux with oh-my-zsh.
Multiple java versions are installed, but none of them is available.
I think the problem is JAVA_HOME is incorrectly set at some point?
❯ sdk install java
Downloading: java 11.0.7.hs-adpt
In progress...
############################################################################################################################################################################################################# 100.0%############################################################################################################################################################################################################# 100.0%
Repackaging Java 11.0.7.hs-adpt...
Done repackaging...
Installing: java 11.0.7.hs-adpt
Done installing!
Do you want java 11.0.7.hs-adpt to be set as default? (Y/n): y
Setting java 11.0.7.hs-adpt as default.
❯ which java
java not found
❯ echo $JAVA_HOME
/home/agilob/.sdkman/candidates/java/current
❯ cd $JAVA_HOME/bin
❯ ls
jaotc jarsigner javac javap jconsole jdeprscan jfr jimage jjs jmap jps jshell jstat keytool rmic rmiregistry unpack200
jar java javadoc jcmd jdb jdeps jhsdb jinfo jlink jmod jrunscript jstack jstatd pack200 rmid serialver
❯ cd
❯ java
zsh: command not found: java
❯ sdk use java 11.0.7.hs-adpt
Using java version 11.0.7.hs-adpt in this shell.
❯ java
Usage: java [options] <mainclass> [args...]
...
JAVA FOUND NOW
...
Open another shell
❯ java
zsh: command not found: java
❯ sdk default java 11.0.7.hs-adpt
Default java version set to 11.0.7.hs-adpt
❯ java
zsh: command not found: java
❯ sdk use java 11.0.7.hs-adpt
Using java version 11.0.7.hs-adpt in this shell.
❯ java
Usage: java [options] <mainclass> [args...]
(to execute a class)
or java [options] -jar <jarfile> [args...]
JAVA FOUND again
It looks like sdk default
doesnt set correct path leading to /java/@current
New shell
❯ sdk default java 11.0.7.hs-adpt
Default java version set to 11.0.7.hs-adpt
❯ java
zsh: command not found: java
❯ which java
java not found
❯ echo $JAVA_HOME
/home/agilob/.sdkman/candidates/java/current
New shell:
❯ sdk use java 11.0.7.hs-adpt
Using java version 11.0.7.hs-adpt in this shell.
❯ java
Usage: java [options] <mainclass> [args...]
❯ echo $JAVA_HOME
/home/agilob/.sdkman/candidates/java/11.0.7.hs-adpt
❯ sdk version
SDKMAN 5.8.2+493
❯ zsh --version
zsh --version
zsh 5.8 (x86_64-pc-linux-gnu)
I can reproduce it with 14.0.1.hs-adpt
11.0.7.hs-adpt
and 8.0.252-open
Scala maven and gradle work fine out of box
I'm can reproduce it on another computer with archlinux.
@agilob I've just tried to replicate this but can't. I'm also on arch linux with oh-my-zsh. I then tried running up a fresh ubuntu docker container, once again it all works fine.
Could you please check that you don't have any special options set in your .zshrc file? Also, can you confirm that you are not using a login shell?
Could you please check that you don't have any special options set in your .zshrc file?
Thanks for info, I investigated it and have to say I had some crap in .profile :(
Using SDKMAN on Catalina yields a strange result with some old applications such as Talend:
but the jdk is clearly available:
sdk home java 8.0.202-zulu /Users/ed/.sdkman/candidates/java/8.0.202-zulu
○ echo $JAVA_HOME /Users/ed/.sdkman/candidates/java/current