我正在尝试运行一个打印“Hello World!”的应用程序。该脚本在本地运行良好,但每次我运行它时
:load /path/to/script
输出:
Loading /u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.scala...
defined object test1
我试过用 spark-shell 启动它
spark-shell -i /path/to/script
但这也无法产生输出“Hello World”
我也尝试过调用 .Main 。
scala>:加载/u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.scala加载/u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.scala。 .. 定义对象 test1
scala> /u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.Main(Array("a")) :1: error: ';' 预期但“。” 成立。/u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.Main(Array("a"))
在定义对象 test1 后,我尝试删除文件路径:
scala> :load /u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.scala
Loading /u/hdpdlcu/Matt/test/SparkScalaCourse/src/com/sundogsoftware/spark/test1.scala...
defined object test1
scala> test1.main("a")
<console>:26: error: value main is not a member of object test1
test1.main("a")
^
scala> test1.main()
<console>:26: error: value main is not a member of object test1
test1.main()
^
test1.scala:
package com.sundogsoftware.spark
object test1 {
def Main (args: Array[String]) {
println("Hello World!")
}
}