Uploaded image for project: 'JDK'
  1. JDK
  2. JDK-6599987

Calling Desktop.open() on an mp3 file fails with IOException

    Details

    • Subcomponent:
    • CPU:
      x86, sparc
    • OS:
      solaris_2.5.1, windows_xp

      Description

      OPERATING SYSTEM(S):
      --------------------
      Windows XP Professional SP2

      FULL JDK VERSION(S):
      -------------------
      java version "1.6.0_02"
      Java(TM) SE Runtime Environment (build 1.6.0_02-b04)
      Java HotSpot(TM) Client VM (build 1.6.0_02-b04, mixed mode)

      DESCRIPTION:
      ------------

      PROBLEM DESCRIPTION

      Opening an MP3 file using Desktop.open() failed with IOException.

      Note: problem is seen only on some machines (Where winamp is not available as default mp3 player and windows media player is the only player by default available for mp3 files).

      Exception details are below:

      java.io.IOException: Failed to open file:/C:/hello.mp3. Error mess
      age: The system cannot find the file specified.

              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 DesktopOpen.main(DesktopOpen.java:14)


      TEST CASE:

      import java.awt.Desktop;
      import java.io.*;

      class DesktopOpenTest {

          DesktopOpenTest()
          {
          }

          public static void main(String args[])
          {
              if (args.length <= 0) {
                  System.out.println("usage: java DesktopOpenTest <filename>");
                  System.exit(-1);
              }
              Desktop desktop = null;
              if (Desktop.isDesktopSupported())
                  desktop = Desktop.getDesktop();
              else
                  System.out.println("Desktop is not supported on this platform");
              try {
                  desktop.open(new File(args[0]));
              } catch (IOException ioexception) {
                  System.out.println("Desktop open failed with IOException");
                  ioexception.printStackTrace();
              }
          }
      }

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                denis Denis Fokin (Inactive)
                Reporter:
                elarsen Erik Larsen (Inactive)
              • Votes:
                0 Vote for this issue
                Watchers:
                0 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved:
                  Imported:
                  Indexed: