Invalid file destination in Java?
<pre><code>    Scanner user = new Scanner(System.in);
    String word;

    System.out.println("Location of file: ");
    word = user.nextLine();

    FileReader fileOpen = new FileReader(word);
    BufferedReader fileRead = new BufferedReader(fileOpen);
</code></pre>

<p>How can I do an error check if the user enters a wrong file destination? </p>

<p>I get:</p>

<pre><code>    java.io.FileNotFoundException:
</code></pre>

<p>when a invalid file destination is entered. </p>

<p>I want the program to say something like </p>

<pre><code>System.out.println("Invalid directory");
</code></pre>

<p>I get errors for the methods isDirectory() and exists() telling me they don't exist for the type String when I try:</p>

<pre><code>if (word.exists())
{
  //do blah blah
}
else 
{
  //Print error
}
</code></pre>
