public class PlayMusicWithJava {
public static void main(String args[])
{
String windowsMediaPlayer="\"%programfiles%\\Windows Media Player\\wmplayer.exe\"";
String songPath="C:\\mymusic\\salsa.mp3"; // mymusic is the folder name
try
{
Runtime.getRuntime().exec("cmd /c start "+windowsMediaPlayer+" "+songPath);
}
catch(Exception e)
{
System.out.println(e.getMessage());
}
}
}
No comments:
Post a Comment