I am trying to find out how to open an mp3 file in the user's default mp3 player using Java code.
In win32 I can use a function called shell execute & it will open the mp3 file using whatever application is the default mp3 player (for example Windows Media Player, Real Player etc.).
Is there a function in Java that allows me to open an mp3 file with the default mp3 player?
This code throws an error, it will only let me open an application, I cannot open any other type(shortcut, mp3, mpeg etc.).
try { Runtime run = Runtime.getRuntime(); Process pr = run.exec( "music.mp3" ); pr.waitFor(); } catch (InterruptedException e) { e.printStackTrace(); } catch (IOException e) { e.printStackTrace(); } catch (Exception e) { e.printStackTrace(); }
This post has been edited by gretty: 01 August 2010 - 09:14 PM