You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@spark.apache.org by "sagarcasual ." <sa...@gmail.com> on 2016/09/08 22:27:45 UTC

Access application-jar name within main method.

Hello,
I am running Spark 1.6.1 and would like to access application Jar name
within my main() method.
somehow
I am using following code to get the version name,

String sparkJarName = new
java.io.File(MySparkProcessor.class.getProtectionDomain()
        .getCodeSource()
        .getLocation()
        .getPath())
        .getName();

It works fine when I run it using Java but via Spark-submit I always
get the jar name as

__app__.jar, and the real jar name that I specify in submit is
completely different, any idea how do I access actual jar name?