Save JavaRDD to HDFS from Spark
<p>I am trying to save my Spark JavaRDD to HDFS. The process run successfully but I do not see file saved in HDFS. Below is my code. I am running it locally. (running main() method directly from IntelliJ.)</p>

<pre><code>public static void main(String[] args){

        String file = "/Path/to/file/abc.csv";

        SparkConf conf = new SparkConf().setAppName("test").setMaster("local");
        JavaSparkContext sc = new JavaSparkContext(conf);

       JavaRDD&lt;String&gt; lines = sc.textFile(file);


        JavaRDD&lt;String &gt; filteredLines = lines.filter(new Function&lt;String, Boolean&gt;() {
            @Override
            public Boolean call(String s) throws Exception {
                return s.contains("Hollywood");
            }
        });

        filteredLines.coalesce(1).saveAsObjectFile("hdfs://localhost:9000/input");

        sc.close();
    }
</code></pre>

<p>I am running this code on Spark 2.0 and Hadoop 2.7.2. In my hadoop core-site.xml is configured as localhost:9000. I am starting my HDFS pseudo distributed cluster as mentioned in the hadoop documentation.</p>

<p>What am I missing here? </p>