Skip to content

[macOS] Zulu install in /Library/Java/JavaVirtualMachines fails when java_macos_integration_enable = yes #137

@delgurth

Description

@delgurth

After enabling

java_macos_integration_enable = yes

It seems the location for the MacOS folder and Info.plist files for Zulu is not working as expected:

$ asdf install java zulu-8.52.0.23
...
Integrating with /usr/libexec/java_home needs root permission for it to create folders under /Library/Java/JavaVirtualMachines
cp: /Users/<username>/.asdf/Contents/MacOS: No such file or directory
cp: /Users/<username>/.asdf/Contents/Info.plist: No such file or directory

Which results in the MacOS java_home command being unable to find the installed runtime:

$ /usr/libexec/java_home -V
The operation couldn’t be completed. Unable to locate a Java Runtime.
Please visit http://www.java.com for information on installing Java.

Installing for example Adopt OpenJDK I'm getting the expected results:

$ asdf install java adoptopenjdk-15.0.2+7
...
Integrating with /usr/libexec/java_home needs root permission for it to create folders under /Library/Java/JavaVirtualMachines

And then

$ /usr/libexec/java_home -V
Matching Java Virtual Machines (1):
    15.0.2 (x86_64) "AdoptOpenJDK" - "OpenJDK 15.0.2" /Library/Java/JavaVirtualMachines/adoptopenjdk-15.0.2+7/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-15.0.2+7/Contents/Home

The problem resides in the usage of absolute_dir_path combined with a file (release) and not a directory.

Changing release into bin/.. fixes it for me.

$ asdf install java zulu-11.45.27
Integrating with /usr/libexec/java_home needs root permission for it to create folders under /Library/Java/JavaVirtualMachines
$ /usr/libexec/java_home -V
Matching Java Virtual Machines (2):
    15.0.2 (x86_64) "AdoptOpenJDK" - "OpenJDK 15.0.2" /Library/Java/JavaVirtualMachines/adoptopenjdk-15.0.2+7/Contents/Home
    11.0.10 (x86_64) "Azul Systems, Inc." - "Zulu 11.45.27" /Library/Java/JavaVirtualMachines/zulu-11.45.27/Contents/Home
/Library/Java/JavaVirtualMachines/adoptopenjdk-15.0.2+7/Contents/Home

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions