This site is currently read-only as we are migrating to Oracle Forums for an improved community experience. You will not be able to initiate activity until January 31st, when you will be able to use this site as normal.

    Forum Stats

  • 3,890,899 Users
  • 2,269,649 Discussions
  • 7,916,821 Comments

Discussions

Desktop Failed to open file:

802471
802471 Member Posts: 12
edited Oct 4, 2010 1:07PM in Abstract Window Toolkit (AWT)
Hello,

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());

        Desktop.getDesktop().open(f);
    }
}
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.

vpy

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

Answers

This discussion has been closed.