Github user andrewor14 commented on a diff in the pull request: https://github.com/apache/spark/pull/3561#discussion_r21712174 --- Diff: core/src/main/scala/org/apache/spark/deploy/SparkSubmitArguments.scala --- @@ -123,14 +124,25 @@ private[spark] class SparkSubmitArguments(args: Seq[String], env: Map[String, St // Try to set main class from JAR if no --class argument is given if (mainClass == null && !isPython && primaryResource != null) { - try { - val jar = new JarFile(primaryResource) - // Note that this might still return null if no main-class is set; we catch that later - mainClass = jar.getManifest.getMainAttributes.getValue("Main-Class") - } catch { - case e: Exception => - SparkSubmit.printErrorAndExit("Cannot load main class from JAR: " + primaryResource) + val uri = new URI(primaryResource) + val uriScheme = uri.getScheme() + // Note that this might still return null if no main-class is set; we catch that later + mainClass = uriScheme match { + case "file" => { + try { + val jar = new JarFile(uri.getPath) + jar.getManifest.getMainAttributes.getValue("Main-Class") + } catch { + case e: Exception => + SparkSubmit.printErrorAndExit("Cannot load main class from JAR: " + primaryResource) + return + } + } + case _ => { --- End diff -- please remove spurious spaces. Also, no need to have `{ }` after `case =>`
--- If your project is set up for it, you can reply to this email and have your reply appear on GitHub as well. If your project does not have this feature enabled and wishes so, or if the feature is enabled but not working, please contact infrastructure at infrastruct...@apache.org or file a JIRA ticket with INFRA. --- --------------------------------------------------------------------- To unsubscribe, e-mail: reviews-unsubscr...@spark.apache.org For additional commands, e-mail: reviews-h...@spark.apache.org