title: unable to read file in java spark
body: <p>I am trying to run the spark program on java using eclipse. Its is running if i simply print something on console but I am not able to read any file using textFile function. 
  I have read somewhere that reading  a file can only be done using HDFS but I am not able to do in my local system.
  Do let me know how to access/read file , if using HDFS then how to install HDFS in my local system so that i can rad the text file.</p>
  
  <p>Here's a code on which I am testing , though this program is working fine but it is unable to read file saying Input path does not exist.</p>
  
  <pre><code>package spark;
  
  import org.apache.spark.SparkConf;
  import org.apache.spark.api.java.JavaRDD;
  import org.apache.spark.api.java.JavaSparkContext;
  import org.apache.spark.sql.DataFrame;
  import org.apache.spark.sql.SQLContext;
  
  import org.apache.spark.api.java.function.Function;
  
  public class TestSpark {
  
      public static void main(String args[])
      {
          String[] jars = {"D:\\customJars\\spark.jar"};
          System.setProperty("hadoop.home.dir", "D:\\hadoop-common-2.2.0-bin-master");
          SparkConf sparkConf = new SparkConf().setAppName("spark.TestSpark")
                  .setMaster("spark://10.1.50.165:7077")
                  .setJars(jars);
  
          JavaSparkContext jsc = new JavaSparkContext(sparkConf);
          SQLContext sqlcon = new SQLContext(jsc);
          String inputFileName = "./forecaster.txt" ;
          JavaRDD&lt;String&gt; logData = jsc.textFile(inputFileName);
          long numAs = logData.filter(new Function&lt;String, Boolean&gt;() {
  
              @Override
              public Boolean call(String s) throws Exception {
                  return s.contains("a");
              }
          }).count();
  
          long numBs = logData.filter(new Function&lt;String, Boolean&gt;() {
                public Boolean call(String s) { return s.contains("b"); }
              }).count();
  
           System.out.println("Lines with a: " + numAs + ", lines with b: " + numBs);
          System.out.println("sadasdasdf");
  
          jsc.stop();
          jsc.close();
      }
  
  }
  </code></pre>
  
  <p>My File Struture :
  <a href="https://i.stack.imgur.com/Pe4Im.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pe4Im.png" alt="enter image description here"></a></p>