Skip to content

Metals ignores JAVA_HOME because locate-java-home npm… #657

@hedefalk

Description

@hedefalk

metals-vscode doesn't honor JAVA_HOME because it uses locate-java-home npm packages that doesn't. There's a PR to fix that but it seems to be a dead project?

There's a fork for this:
jvilk/locate-java-home#10 (comment)

https://github.com/viperproject/locate-java-home

Maybe metals can switch to that?

❯ npx locate-java-home                                                                                                                                           
npx: installed 4 in 1.996s
JAVA_HOME directories found: 

❯ echo $JAVA_HOME
env-/nix/store/7gxklxmf8d2c15jmw3i9l67kd2zci3w5-adoptopenjdk-hotspot-bin-11.0.10

✗ npx viperproject/locate-java-home 
npx: installed 5 in 26.395s
JAVA_HOME directories found: 
11.0.10 /nix/store/7gxklxmf8d2c15jmw3i9l67kd2zci3w5-adoptopenjdk-hotspot-bin-11.0.10 [64-bit] [JDK]
11.0.10 /nix/store/7gxklxmf8d2c15jmw3i9l67kd2zci3w5-adoptopenjdk-hotspot-bin-11.0.10/Contents/Home [64-bit] [JDK]

Currently, I have to go in to vscode settings over and over to set something dependent on my nix config.

Installation:

  • Operating system: macOS

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions