use this val data = sc.textFile("/home/spark/data.txt") this should work and set master as local.

Input path does not exist解决方法

spark-submit --master local 即可解决!

 

参考:https://stackoverflow.com/questions/41339127/how-to-load-local-file-using-sc-textfile-in-spark

其他解决方法:https://stackoverflow.com/questions/35123245/load-local-file-not-hdfs-fails-at-spark