一、下載示例代碼:
git clone https://github.com/melphi/spark-examples.git
從示例代碼中可以看到 pox中引入了 Spark開發所需要的依賴。
二、把代碼導入 IDE
IDE應該會識別這是 Maven項目,在IDE中打包:

打包后,在項目根目錄中,target文件夾內會生成文件 first-example-1.0-SNAPSHOT.jar

運行該程序
命令為:
bin/spark-submit --class org.sparkexample.WordCount --master local[2] D:\first-example\target\spark-examples-1.0-SNAPSHOT.jar F:\test\input.txt F:\NJU\test\output

具體語法請見:http://spark.apache.org/docs/latest/submitting-applications.html
查看結果
F:\test\output\ 中能看到詞頻統計的結果

