diff --git a/src/index.ts b/src/index.ts index 74b04e1..8301dd9 100644 --- a/src/index.ts +++ b/src/index.ts @@ -18,6 +18,7 @@ import * as path from "path"; import * as cp from "child_process"; import which from "which"; import WinReg, { Registry } from "winreg"; +import { execSync } from 'child_process'; const isWindows: boolean = process.platform.indexOf('win') === 0; const jdkRegistryKeyPaths: string[] = [ @@ -91,6 +92,15 @@ function findInPath(JAVA_FILENAME: string) { return resolve(null); } + if (/\.jenv\/shims/.test(proposed)) { + try { + const jenvProposed: string = execSync(`jenv which ${JAVA_FILENAME}`).toString().trim(); + proposed = jenvProposed; + } catch (ex) { + console.error(ex); + } + } + //resolve symlinks proposed = findLinkedFile(proposed);