diff --git a/bin/kcl-bootstrap b/bin/kcl-bootstrap index 1866b6bc..bf083eb7 100755 --- a/bin/kcl-bootstrap +++ b/bin/kcl-bootstrap @@ -2,7 +2,17 @@ /*** Copyright 2019 Amazon.com, Inc. or its affiliates. All Rights Reserved. -SPDX-License-Identifier: Apache-2.0 + +Licensed under the Amazon Software License (the "License"). +You may not use this file except in compliance with the License. +A copy of the License is located at + +http://aws.amazon.com/asl/ + +or in the "license" file accompanying this file. This file is distributed +on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either +express or implied. See the License for the specific language governing +permissions and limitations under the License. ***/ 'use strict'; @@ -98,6 +108,10 @@ function bootstrap() { }); } +function createJavaHomeExecutablePath() { + return path.join(process.env.JAVA_HOME, 'bin', process.platform !== 'win32' ? 'java' : 'java.exe'); +} + function parseArguments() { program .option('-p, --properties [properties file]', 'properties file with multi-language daemon options') @@ -110,7 +124,7 @@ function parseArguments() { var args = { 'properties': program.properties, 'logConfiguration': program.logConfiguration ? program.logConfiguration: null, - 'java': (program.java ? program.java : (process.env.JAVA_HOME ? path.join(process.env.JAVA_HOME, 'bin', 'java') : null)), + 'java': (program.java ? program.java : (process.env.JAVA_HOME ? createJavaHomeExecutablePath() : null)), 'jarPath': (program.jarPath ? program.jarPath : DEFAULT_JAR_PATH), 'execute': program.execute }; @@ -137,14 +151,10 @@ function parseArguments() { } function startKinesisClientLibraryApplication(options) { - var classpath = '-cp ' + getClasspath(options).join(getPathDelimiter()); + var classpath = getClasspath(options).join(getPathDelimiter()); var java = options.java; - var propertiesFile = '--properties-file ' + options.properties; - var logConfiguration = ''; - if (options.logConfiguration) { - logConfiguration = '--log-configuration ' + options.logConfiguration; - } - var args = [classpath, MULTI_LANG_DAEMON_CLASS, propertiesFile, logConfiguration]; + var logConfiguration = options.logConfiguration ? ['--log-configuration', options.logConfiguration] : []; + var args = ['-cp', classpath, MULTI_LANG_DAEMON_CLASS, '--properties-file', options.properties, ...logConfiguration]; var cmd = java + ' ' + args.join(' '); console.log("=========================================================="); @@ -326,4 +336,4 @@ function errorExit(err) { process.exit(1); } -bootstrap(); +bootstrap(); \ No newline at end of file