Eskibear / node-jdk-utils

A collection of Java related utils.
MIT License
10 stars 5 forks source link

macOS: support to detect from Homebrew #4

Closed Eskibear closed 2 years ago

Eskibear commented 2 years ago

to fix #2

smoke test:

$> ls -l /usr/local/opt/ | grep jdk
lrwxr-xr-x  1 sechs  admin  24 Dec 10  2020 java -> ../Cellar/openjdk/15.0.1
lrwxr-xr-x  1 sechs  admin  28 Dec 20 21:31 java11 -> ../Cellar/openjdk@11/11.0.12
lrwxr-xr-x  1 sechs  admin  24 Dec 10  2020 openjdk -> ../Cellar/openjdk/15.0.1
lrwxr-xr-x  1 sechs  admin  28 Dec 20 21:31 openjdk@11 -> ../Cellar/openjdk@11/11.0.12
lrwxr-xr-x  1 sechs  admin  24 Dec 10  2020 openjdk@15 -> ../Cellar/openjdk/15.0.1

$> export PATH=/usr/local/opt/openjdk/bin:$PATH

findRuntimes:
...
  {
    homedir: '/usr/local/Cellar/openjdk/15.0.1/libexec/openjdk.jdk/Contents/Home',
    isInPathEnv: true,
    hasJavac: true,
    version: { java_version: '15.0.1', major: 15 }
  },
  {
    homedir: '/usr/local/Cellar/openjdk@11/11.0.12/libexec/openjdk.jdk/Contents/Home',
    hasJavac: true,
    version: { java_version: '11.0.12', major: 11 }
  }
...