2 Replies Latest reply: Oct 4, 2010 12:07 PM by 802471 RSS

    Desktop Failed to open file:


      I'm having trouble with java opening a .mpg file using Desktop.open(). I keep getting this error:
      Exception in thread "main" java.io.IOException: 
      Failed to open file:/C:/Users/user/Desktop/01-entrance-lobby.mpg. 
      Error message: No application is associated with the specified file for this operation.
              at sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:59)
              at sun.awt.windows.WDesktopPeer.open(WDesktopPeer.java:36)
              at java.awt.Desktop.open(Desktop.java:254)
              at SSCE.main(SSCE.java:26)
      Java Result: 1
      Even the SSCE has failed:
      public class SSCE {
          * @param args the command line arguments
          public static void main(String args[]) throws Exception {
              File f = new File("C:\\Users\\user\\Desktop\\01-entrance-lobby.mpg");
              System.out.println("file exist: " + f.exists());
      I've made sure that the file has an associated program to open it. I'm using JDK 1.6.0 Update 21. I've tried it using a .png file and it works but a .pdf file fails. Any help on this is much appreciated. Thanks.


      Edited by: vpy on Oct 4, 2010 9:04 AM