Error: Could not find or load main class org.test.spark011.word



0

HI,

While running simple word count prgram,i am facing error.:

Error: Could not find or load main class org.test.spark011.word

Code:       

package org.test.spark011
import org.apache.spark.SparkConf
import org.apache.spark.SparkContext

object word {
  def main(args:Array[String]){
  val conf = new SparkConf()
               .setAppName("wc")
               .setMaster("local")
               
   val sc=new SparkContext(conf)  
   val inputrdd=sc.textFile(args(0))
   val wordFlatmap=inputrdd.flatMap(line=>line.split(" "))
   val wordmap=wordFlatmap.map(word=>(word,1))
   val wc=wordmap.reduceByKey(_+_)
   wc.saveAsTextFile(args(1))
}
}


3 Answer(s)


0

Hi,

Check if Your main class in on build path.

Project -> Properties -> Java Build Path -> Source tab

If not add appropriate folder(s).

Thanks.


0

I have the same error:

Error: Could not find or load main class org.test.spark.WordCount

org.test.spark is a package created under source folder and should be in the build path.

Please advise how to add folder to:

Project -> Properties -> Java Build Path -> Source tab


0

Hi,

While running Spark program in my virtual box ,I am getting Could not find or load main class.

Plz suggest how to add folder to:

Project -> Properties -> Java Build Path -> Source tab