title: Unparseable date error on Java
body: <pre><code>import java.io.File;
  import java.text.SimpleDateFormat;
  import java.util.Date;
  import java.util.Map;
  import java.util.Scanner;
  import java.util.TreeMap;
  
  public class L10C
  {
  
      public static void main(String[] args) throws Exception
      {
          File f = new File("src/Birthdates.txt");
          Scanner input = new Scanner(f);
  
          //-------------------------------------------------Read File &amp; Create N2D Map
          Map&lt;String, Date&gt; n2d = new TreeMap&lt;String, Date&gt;();
          int n = input.nextInt();
          for (int r = 0; r &lt; n; r++)
          {
              // String record = input.nextLine();
              // parse record into two pieces
  
              String name = input.next();
              String birthdateString = input.nextLine();
              SimpleDateFormat sdf = new SimpleDateFormat("MMM dd, yyyy");
              Date birthdate = sdf.parse(birthdateString.trim());
              //System.out.println(name+" - " + birthdate);
              n2d.put(name, birthdate);
          }
          System.out.println("N2D: " + n2d); // debugging output
  
          //-------------------------------------------------Read File &amp; Create D2N Map
          Map&lt;Date, String&gt; d2n = new TreeMap&lt;Date, String&gt;();
          for (String s : n2d.keySet())
          {
              Date d = n2d.get(s);
              if (!d2n.containsKey(d))
              {
                  d2n.put(d, s);
              }
              else
              {
                  String existingName = d2n.get(d);
                  if (s.compareTo(existingName) == -1) // means s &lt; existingName
                  {
                      d2n.put(d, s);
                  }
              }
          }
          System.out.println("D2N: " + d2n); // debugging outpu
  
          //-------------------------------------------------Output D2N Formatted
          for (Date d : d2n.keySet())
          {
              System.out.printf("%tb %&lt;td, %&lt;tY --&gt; %s\n", d, d2n.get(d));
          }
      }
  }
  </code></pre>
  
  <p>Hi. I get </p>
  
  <pre>
  Exception in thread "main" java.text.ParseException: Unparseable date: "Jun 7, 1996"
      at java.text.DateFormat.parse(DateFormat.java:366)
      at L10C.main(L10C.java:27)
  </pre>
  
  <p>error, my txt file has following inputs:</p>
  
  <blockquote>
    <p>7
    Randy Jun 7, 1996<br>
    Omar   Feb 20, 1999<br>
    Sue      Sep 14, 1990<br>
    Chris  Sep 14, 1990<br>
    Adam Feb 20, 1996<br>
    Jim    Sep 14, 1990<br>
    Phillip   Oct 27, 1994</p>
  </blockquote>
  
  <p>How can I fix error?</p>