halcyon/asdf-java

.asdfrc for macOS java_home not working

Opened this issue · 6 comments

I created the asdfrc file and added that key value pair

Proof

coltonidle@MacBook-Air ~ % cat ~/.asdfrc 
java_macos_integration_enable = yes

coltonidle@MacBook-Air ~ %

Running java_home or /usr/libexec/java_home greets me with this error

coltonidle@MacBook-Air ~ % /usr/libexec/java_home
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

I'm on a brand new m1 macbook where I just installed zulu. echo $JAVA_HOME shows /Users/coltonidle/.asdf/installs/java/zulu-11.48.21/zulu-11.jdk/Contents/Home

Am I doing something wrong?

Hello there !

I had encounter the same issue recently.

java_macos_integration_enable is used when you're installing the version of java that you need.

Try to reinstall and tell me if it's working :)

@Drfloo Try to reinstall java? Or asdf?

The asdf package for java. ( zulu. ... for you i think )

asdf uninstall
asdf install

Alright... idk if this is what you meant @Drfloo (sorry I'm still new to asdf)

but I ran asdf uninstall java then asdf install java and now running /usr/libexec/java_home shows /Library/Java/JavaVirtualMachines/zulu-11.48.21/Contents/Home Hooray!

So it's working now ? great !

Sorry my previous response was uncompleted :
asdf uninstall java
asdf install java

To resume it wasn't working before because you create the .asdfrc AFTER installing your package. You need to do this before installing.

this also happened to me. apparently you need to add the asdfrc before installing and I didn't know that! Probably the readme of that part should be around the installation.