title: How to show an error message in java in a friendly way
body: <p>I have a question as i am a beginner in java you may find it silly.</p>
  
  <p>I am writing a method to read a file and when it does not exist an error just show up.</p>
  
  <pre><code>File f = new File(FILE_path);
              if (f.exists() &amp;&amp; f.canRead()) {
                  try {
                      //Do something
                  } catch (IOException e) {
                      e.printStackTrace();
                      LOGGER.error("Error message: " + e.getMessage());
                  }
              } else {
                  LOGGER.error("File does not exist or it cannot be read.");
              }
  </code></pre>
  
  <p>but other than the error that it shows the red error also shows up and then the program stops.</p>
  
  <pre><code> Exception in thread "main" java.io.FileNotFoundException: /home/project/file_path (No such file or directory)
      at java.io.FileInputStream.open(Native Method)
      at java.io.FileInputStream.&lt;init&gt;(FileInputStream.java:146)
  </code></pre>
  
  <p>Now my question is that is there anyway that the program does not freeze at this level and we show only the friendly message? or we cannot avoid that and this Exception error always show up even we use try and catch?</p>