How To Play MP3 Files in Java Eclipse

How is it going coders? for today Tutor… I’m gonna tell y’all how to Play MP3 files in Java Program. Just like always for todays example I’m using Eclipse, you could use it or any other IDE that suites you. For todays program I’m using MP3 files, so thats not too hard to find.

 First of all you need to have your MP3 files inside your source folder like this :

Just look at that “Mfg” MP3 files that I have inside my source folder for “MainMP3” Program.
Now for the coding Spices :

Wait!!! Before all of that You need to Download JLayer Here :  JLayer
And add it to your program Build Path using “Add External JARs” :

//1st now well import the important classes
//(notice that there is a class/package named javazoom.jl…)


import javazoom.jl.decoder.JavaLayerException;
import javazoom.jl.player.Player;

//2nd we create our method inside our class
public class MainMP2 {

//here we create the main method

    public static void main(String[] args){
        FileInputStream fileInputStream = new FileInputStream(“Mfg.mp3”);
 //here we find our sound file
        Player player = new Player(fileInputStream);;
        System.out.println(“Song is Playing”);
        } catch(FileNotFoundException e){
        }catch(JavaLayerException e){

Well since I can’t tell you how it sounds in here, you can go and check my Youtube Channel for the Voice explanation : MP3 Files in Java Eclipse Check it out!! and subscribe

Published by

Rafif Santika

The programming language that I specialize in is Java, because I think Java programming language is more universal and of course because I like it regardless of any reason.

4 thoughts on “How To Play MP3 Files in Java Eclipse”

  1. I’m speechless. This is a very good blog and really attractive too. Nice work! That’s now not in reality so much coming from an beginner publisher like me, but it’s all I may just say after diving into your posts. Nice grammar and vocabulary. No longer like other blogs. You truly understand what you?re talking about too. Such a lot that you made me wish to discover more. Your weblog has transform a stepping stone for me, my friend.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.