scala - Running Spark Application from Eclipse -
i trying develop spark application on eclipse, , debug stepping through it.
i downloaded spark source code , have added of spark sub projects(such spark-core) eclipse. now, trying develop spark application using eclipse. have installed scalaide on eclipse. created simple application based on example given in spark website.
import org.apache.spark.sparkcontext import org.apache.spark.sparkcontext._ import org.apache.spark.sparkconf object simpleapp { def main(args: array[string]) { val logfile = "your_spark_home/readme.md" // should file on system val conf = new sparkconf().setappname("simple application") val sc = new sparkcontext(conf) val logdata = sc.textfile(logfile, 2).cache() val numas = logdata.filter(line => line.contains("a")).count() val numbs = logdata.filter(line => line.contains("b")).count() println("lines a: %s, lines b: %s".format(numas, numbs)) } }
to project, added spark-core
project dependent project(right click -> build path -> add project). now, trying build application , run it. however, project shows has errors, don't see errors listed in problems view within eclipse, nor see lines highlighted in red. so, not sure problem is. assumption need add external jars project, not sure these jars be. error caused val conf = new sparkconf().setappname("simple application")
, subsequent lines. tried removing lines, , error went away. appreciate , guidance, thanks!
it seems not using package/library manager (e.g. sbt, maven) should eliminate versioning issues. it might challenging set correct version of java, scala, spark , subsequent dependencies on own. recommend change your project maven: convert existing eclipse project maven project
personally, have experiences sbt on intellij idea (https://confluence.jetbrains.com/display/intellijidea/getting+started+with+sbt) easy set , maintain.
Comments
Post a Comment