Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions ts/lib/platforms/darwin.ts
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,13 @@ export default function macFindJavaHome(cb: (homes: string[], executableExtensio
// Map to paths.
// TODO: We assume that quotes cannot be in the paths.
installations = installations.map((install) => install.slice(install.lastIndexOf('"') + 1).trim());

// Option 2: Is JAVA_HOME defined?
// (NOTE: locate_java_home will prune redundancies.)
if (process.env.JAVA_HOME) {
installations.push(process.env.JAVA_HOME!);
}

cb(installations);
});
}
9 changes: 8 additions & 1 deletion ts/lib/platforms/win32.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ interface IKeyInfo {
}

/**
* Find Java on Windows by checking registry keys.
* Find Java on Windows by checking registry keys and PATH
*/
export default function windowsFindJavaHome(cb: (homes: string[], executableExtension?: string) => void): void {
// Windows: JDK path is in either of the following registry keys:
Expand All @@ -24,6 +24,13 @@ export default function windowsFindJavaHome(cb: (homes: string[], executableExte
];

const discoveredJavaHomes: string[] = [];

// Option 1: Is JAVA_HOME defined?
// (NOTE: locate_java_home will prune redundancies.)
if (process.env.JAVA_HOME) {
discoveredJavaHomes.push(process.env.JAVA_HOME!);
}

eachSeries(keysToCheck, (key: string, asyncCb: (err?: Error) => void) => {
getRegistryKey(key, (err?: Error | null, values?: IKeyInfo) => {
if (!err) {
Expand Down