code: private SparkContext createSparkContext(Map<String, String> params) throws DDFException {
      this.setSparkContextParams(this.mergeSparkParamsFromSettings(params));
      String ddfSparkJar = params.get("DDFSPARK_JAR");
  
      String[] jobJars = ddfSparkJar != null ? ddfSparkJar.split(",") : new String[] { };
  
      ArrayList<String> finalJobJars = new ArrayList<String>();
  
      // DDFSPARK_JAR could contain directories too, used in case of Databricks Cloud where we don't have the jars at start-up
      // time but the directory and we will search and includes all of jars at run-time
      for (String jobJar: jobJars) {
        if ((!jobJar.endsWith(".jar")) && (new File(jobJar).list() != null)) {
          // This is a directory
          ArrayList<String> jars = Utils.listJars(jobJar);
          if (jars != null) {
            finalJobJars.addAll(jars);
          }
  
        } else  {
          finalJobJars.add(jobJar);
        }
      }
  
      mLog.info(">>>>> ddfSparkJar = " + ddfSparkJar);
      for(String jar: finalJobJars) {
        mLog.info(">>>>> " + jar);
      }
  
      jobJars = new String[finalJobJars.size()];
      jobJars = finalJobJars.toArray(jobJars);
  
      for (String key : params.keySet()) {
        mLog.info(">>>> key = " + key + ", value = " + params.get(key));
      }
  
      SparkContext context = SparkUtils.createSparkContext(params.get("SPARK_MASTER"), params.get("SPARK_APPNAME"),
          params.get("SPARK_HOME"), jobJars, params);
      this.mSparkContext = context;
      this.mJavaSparkContext = new JavaSparkContext(context);
      return this.getSparkContext();
    }
docs: Side effect: also sets SharkContext and SparkContextParams in case the client wants to examine or use those.
  
  @param params
  @return
  @throws DDFException