寒假学习 7
- sbt 对 Scala 应用程序进行编译打包
/* SimpleApp.scala */
import org.apache.spark.SparkContext
import org.apache.spark.SparkContext._
import org.apache.spark.SparkConf
- object SimpleApp {
def main(args: Array[String]){
val logFile = " hdfs://localhost:9000/user/hadoop/test.txt"
val conf = new SparkConf().setAppName("Simple Application")
val sc = new SparkContext(conf)
val logData = sc.textFile(logFile, 2)
val num = logData.count()
printf("The num of this file is %d", num)
}
}
- 通过如下代码将整个应用程序打包成 JAR:
-