Recently, I was trying some media API and found the JDK 1.6 doesn’t play MP3 files out of the box. So, I searched a little and found JLayer that can play mp3 format, you only have to include its jar file. Other than JLayer there’s Java Media Framework available which involves many installation and configuration steps before getting the code to work. With JLayer you just need to include its dependency like:


and use the API like:

File file = new File("Test.mp3");"located media at "+file.getAbsolutePath());
AdvancedPlayer player = new AdvancedPlayer(new FileInputStream(file), FactoryRegistry.systemRegistry().createAudioDevice());"Starting the music... ");;