Error: not found: sc value

I am new to Scala and trying to execute code by reading a file using the following code

scala> val textFile = sc.textFile("README.md") scala> textFile.count() 

But I keep getting the following error:

 error: not found: value sc 

I tried everything but nothing works. I use Scala version 2.10.4 and Spark 1.1.0 (I even tried Spark 1.2.0, but it doesn't work either). I installed and compiled sbt, but could not start sbt/sbt assembly . Does this cause an error?

+4
source share
1 answer

You must run this code using ./spark-shell . This is scala repl with the provided sparkContext. You can find it in your apache distribution in the spark-1.4.1/bin .

+2
source

All Articles