title: java.io.IOException: The system cannot find the path specified
body: <p>I am trying to open a file i just created in my code (so i am sure that the file exists)</p>
  
  <p>The code is like this:</p>
  
  <pre><code>File file = new File(filename);
  file.createNewFile();
  BufferedWriter bw = new BufferedWriter(new FileWriter(file));
  ...
  bw.close();
  
  try {
      Desktop desktop = null;
      if (Desktop.isDesktopSupported()) {
          desktop = Desktop.getDesktop();
      }
      desktop.open(file);
  } catch (Exception e) {
      ...
  }
  </code></pre>
  
  <p>But as the title says i get a "java.io.IOException: The system cannot find the path specified" from the desktop.open(file) istruction.
  The problem surely is that the file pathname contains spaces (which are translated into "%20"). Is there a way to avoid this?</p>