title: java: Open folder on button click
body: <p>In java, how can we open a <strong>separate</strong> folder (e.g. c:) for user on click of a button, e.g like the way " locate this file on disk" or  "open containing folder" does when we download a file and we want to know where it was saved.  The goal is to save user's time to open a browser and locate the file on disk. 
  Thanks ( image below is an example from what firefox does) 
  <img src="https://i.stack.imgur.com/XctEi.png" alt="enter image description here"></p>
  
  <p>I got the answer:
  Here is what worked for me in Windows 7:</p>
  
  <pre><code>        File foler = new File("C:\\"); // path to the directory to be opened
          Desktop desktop = null;
          if (Desktop.isDesktopSupported()) {
          desktop = Desktop.getDesktop();
          }
  
          try {
          desktop.open(foler);
          } catch (IOException e) {
          }
  </code></pre>
  
  <p>Thanks to @AlexS</p>