diff --git a/nodejs-packages/jvm-launch-utils/package.json b/nodejs-packages/jvm-launch-utils/package.json index db7e6a98a..721071ce7 100644 --- a/nodejs-packages/jvm-launch-utils/package.json +++ b/nodejs-packages/jvm-launch-utils/package.json @@ -1,6 +1,6 @@ { "name": "@pivotal-tools/jvm-launch-utils", - "version": "0.0.13", + "version": "0.0.14", "description": "Provides utilities useful for launching Java processes from node packages.", "files": [ "src", diff --git a/nodejs-packages/jvm-launch-utils/src/jvm-util.ts b/nodejs-packages/jvm-launch-utils/src/jvm-util.ts index dce8a43d6..e41b295d1 100644 --- a/nodejs-packages/jvm-launch-utils/src/jvm-util.ts +++ b/nodejs-packages/jvm-launch-utils/src/jvm-util.ts @@ -55,15 +55,19 @@ export interface JVM { * toolsjar and to check whether the JVM is a JDK. */ export function findJvm(javaHome?: string) : Promise { - let javaExe = findJavaExe(javaHome); - if (javaExe) { - return getJavaInfo(javaExe).then(javaProps => new JVMImpl( - javaProps.get("java.home"), - javaExe, - getMajorVersion(javaProps) - )); + try { + let javaExe = findJavaExe(javaHome); + if (javaExe) { + return getJavaInfo(javaExe).then(javaProps => new JVMImpl( + javaProps.get("java.home"), + javaExe, + getMajorVersion(javaProps) + )); + } + return Promise.resolve(null); + } catch (e) { + return Promise.reject(e); } - return Promise.resolve(null); } /**