SparkConf conf = new SparkConf().setAppName("Sample"); JavaSparkContext sc = new JavaSparkContext(conf); JavaRDD file =sc.textFile("hdfs://localhost:54310/inputdata.txt");