public static void useAmbariJdkInCommandParams(Map<String, String> commandParams, Configuration configuration) {
    if (StringUtils.isNotEmpty(configuration.getJavaHome()) && !configuration.getJavaHome().equals(configuration.getStackJavaHome())) {
      commandParams.put(AMBARI_JAVA_HOME, configuration.getAmbariJavaHome());
      commandParams.put(AMBARI_JAVA_VERSION, String.valueOf(configuration.getJavaVersion()));
      if (StringUtils.isNotEmpty(configuration.getJDKName())) { // if not custom jdk
        commandParams.put(AMBARI_JDK_NAME, configuration.getJDKName());
      }
      if (StringUtils.isNotEmpty(configuration.getJCEName())) { // if not custom jdk
        commandParams.put(AMBARI_JCE_NAME, configuration.getJCEName());
      }
    }
  }
Add ambari specific JDK details to command parameters.
ambari-server/src/main/java/org/apache/ambari/server/utils/StageUtils.java