1

我正在使用 javaDesktop类尝试使用其本机应用程序启动视频,启动它的代码是:

Desktop.getDesktop().open(myVideoFile);

视频文件是一个 wmv 文件,但每当我尝试启动它时,都会出现以下异常

Unexpected Error


Message:
    java.security.PrivilegedActionException: java.security.PrivilegedActionException: java.io.IOException: Failed to open file:/C:/Users/me/desktop/video.wmv. Error message: Unspecified error
Level:
    SEVERE
Stack Trace:
null
    java.security.AccessController.doPrivileged(Native Method)
    java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
null
    java.security.AccessController.doPrivileged(Native Method)
    java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:98)
    java.awt.EventQueue$2.run(EventQueue.java:621)
    java.awt.EventQueue$2.run(EventQueue.java:619)
    java.security.AccessController.doPrivileged(Native Method)
    java.security.AccessControlContext$1.doIntersectionPrivilege(AccessControlContext.java:87)
    java.awt.EventQueue.dispatchEvent(EventQueue.java:618)
    java.awt.EventDispatchThread.pumpOneEventForFilters(EventDispatchThread.java:269)
    java.awt.EventDispatchThread.pumpEventsForFilter(EventDispatchThread.java:184)
    java.awt.EventDispatchThread.pumpEventsForHierarchy(EventDispatchThread.java:174)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:169)
    java.awt.EventDispatchThread.pumpEvents(EventDispatchThread.java:161)
    java.awt.EventDispatchThread.run(EventDispatchThread.java:122)
Failed to open file:/C:/Users/me/desktop/video.wmv. Error message: Unspecified error
    sun.awt.windows.WDesktopPeer.ShellExecute(WDesktopPeer.java:59)
    sun.awt.windows.WDesktopPeer.open(WDesktopPeer.java:36)
    java.awt.Desktop.open(Desktop.java:254)
    java_awt_Desktop$open.call(Unknown Source)

使用相同的代码打开 jpg 文件是可行的。关于在这里做什么的任何想法?

4

0 回答 0