Dear Pavan,

Hope you are doing well.

Please try the below example

I hope this will help you.


Example:

Code:

import org.apache.spark.SparkConf
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._

object Myobject extends App{

 val conf = new SparkConf().setAppName("Spark Joins").setMaster("yarn")

/*val conf = new SparkContext(new SparkConf().setAppName("SparkJoins").setMaster("yarn"))*/

 val sc = new SparkContext()

println("hello")

}

build.sbt:

name := "Spark_Joins"

version := "1.0"

scalaVersion := "2.10.4"


libraryDependencies += "org.apache.spark" %% "spark-core" % "1.5.2"


spark Submit:

spark-submit --class Myobject  --master yarn --deploy-mode client target/scala-2.10/spark_joins_2.10-1.0.jar

Process:

step1: mkdir Myproject
step2: cd Myproject
step3: mkdir -p src/main/scala
step4: sudo gedit src/main/scala/Myobject.scala (copy the code here)
step5: sudo gedit build.sbt (copy the contents here)
step6: sbt package
step7: spark- submit



Let us know if you face any issue.

We will eagerly wait for your response.


Please share your feedback by clicking any of the below smileys.

Please note if you are not happy with the response on this ticket, please escalate it to escalations@edureka.in.
We assure you that we will get back to you within 24 hours