6

I want to run a standalone Spark script that I've already compiled with sbt package command. How could I set the right configuration of Scala Script to run my script in IntelliJ IDE? Currently I'm using the command line with the following command to run it(but I want to run in IntelliJ to further debugging, for example):

~/spark-1.2.0/bin/spark-submit --class "CoinPipe" target/scala-2.10/coinpipe_2.10-1.0.jar /training/data/dir 7 12

Bellow is a snapshot of what I'm trying to do: The figure shows how I'm trying to configure my script to run in IntelliJ

1
  • Here is a 2 step solution where you run spark-submit and then run the debugger in Intellij: bigendiandata.com/… Commented May 14, 2018 at 16:51

3 Answers 3

5

I realize that this post is old, but I ran into the same problem and found a solution so figured I'd post it here.

  • Create a java application run configuration with main class:

    org.apache.spark.deploy.SparkSubmit
    
  • VM options should include the classpath of spark conf and jars, at a minimum:

    -cp "c:\spark\conf\;c:\spark\jars\*"
    
  • Program arguments should contain your jar file as the first argument, followed by the actual program arguments that you wish to pass to your program:

    yourapp.jar arg1 arg2
    
  • Use classpath of module should be set to your module.

enter image description here

Sign up to request clarification or add additional context in comments.

1 Comment

I correctly chose my module but My IDE showed "org.apache.spark.deploy.SparkSubmit not found in module ". How to fix it?
0

You can setup spark-submit as an External Tool. It won't be in the run menu, though.

Comments

0

Try these steps:

  1. Install sbt plugins: Goto File -> Settings -> Plugins -> Install IntelliJ Plugins -> Search for sbt and install it.
  2. After sbt plugin install, restart intellij and Start New Scala sbt project (File -> New Project -> Scala -> SBT).
  3. Now open up the build.sbt file and add the all the dependencies.
  4. Now Create a new Scala class in src -> main -> scala and type in your code.
  5. Right click and hit Run.

NOTE : You might want to restart intelliJ sometime to get the dependencies pulled from the build.sbt file.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.