spark 2.7 scala 2.12.7,当我使用spark-submit提交一个简单的项目--WordCount时,我确保package和className都可以,但是仍然有错误
java.lang.ClassNotFoundException
作为我的代码:
1 ../ bin / spark-submit --master spark://localhost.localdomain:7077 --class sparkTes.WordCount.scala /java/spark/scala.jar
2。enter image description here 3.火花代码
def main(args: Array[String]): Unit = {
val conf = new SparkConf().setAppName("wordcount");
val sc = new SparkContext(conf)
val input = sc.textFile("/java/text/scala.md", 2).cache()
val lines = input.flatMap(line=>line.split(" "))
val count = lines.map(word => (word,1)).reduceByKey{case (x,y)=>x+y}
val output = count.saveAsTextFile("/java/text/WordCount")
}