title: Searching a CSV file Java
body: <p>Im trying to a specific String of number in a csv file and I keep getting an a FileNotFound exception even though the files exists. I cant seem to fix the problem 
  Sample Csv file </p>
  
  <p>12141895, LM051
  12148963, Lm402
  12418954, Lm876</p>
  
  <p>User Input : 12141895 </p>
  
  <p>Desired Result : True </p>
  
  <pre><code>import javax.swing.*;
  import java.io.FileWriter;
  import java.io.IOException;
  import java.io.PrintWriter;
  
  import java.util.*;
  import javax.swing.*;
  import java.io.*;
  import java.awt.*;
  import java.awt.List;
  
  
  public class tester
  {
  public static void main (String [] args ) throws IOException
  {
  
      boolean cool = checkValidID();
      System.out.println(cool);
  }
  
  public static boolean checkValidID() throws IOException
  {
      boolean results = false;
      Scanner scan = new Scanner(new File("C:\\Users\\Packard Bell\\Desktop\\ProjectOOD\\IDandCourse.csv"));
      String s;
      int indexfound=-1;
      String words[] = new String[500];
      String word = JOptionPane.showInputDialog("Enter your student ID");
  
  
     while (scan.hasNextLine()) 
     {
      s = scan.nextLine();
      if(s.indexOf(word)&gt;-1)
          indexfound++; 
  
      }
  if (indexfound&gt;-1)
  { 
      results = true;
  }
   else 
   {
      results = true;
   }
   return results;
  }
  }
  </code></pre>