user2330778
user2330778

Reputation: 235

error: not found: value sc

I am new to Scala and am trying to code read 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 have tried everything, but nothing seems to work. I am using Scala version 2.10.4 and Spark 1.1.0 (I have even tried Spark 1.2.0 but it doesn't work either). I have sbt installed and compiled yet not able to run sbt/sbt assembly. Is the error because of this?

Upvotes: 5

Views: 7894

Answers (1)

Nikita
Nikita

Reputation: 4515

You should run this code using ./spark-shell. It's scala repl with provided sparkContext. You can find it in your apache spark distribution in folder spark-1.4.1/bin.

Upvotes: 3

Related Questions