How do I pass program-argument to main function in running spark-submit with a JAR?

后端 未结 4 846
悲哀的现实
悲哀的现实 2020-12-29 05:28

I know this is a trivial question, but I could not find the answer on the internet.

I am trying to run a Java class with the main function with program

4条回答
  •  一生所求
    2020-12-29 06:15

    Arguments passed before the .jar file will be arguments to the JVM, where as arguments passed after the jar file will be passed on to the user's program.

    bin/spark-submit --class classname -Xms256m -Xmx1g something.jar someargument
    

    Here, s will equal someargument, whereas the -Xms -Xmx is passed into the JVM.

    public static void main(String[] args) {
    
        String s = args[0];
    }
    

提交回复
热议问题