Results 1 to 2 of 2

Thread: Play mp3

  1. #1
    davidthornton is offline Member
    Join Date
    Feb 2014
    Rep Power

    Default Play mp3

    Hi Everyone,

    I am new to Java, I am using Netbeans to create a simple GUI with one button that just says "play". I want this to play an mp3 file i specify. I have found code to simply play a WAV which works great.

    There is lots of information on the net about playing an mp3 but it's all long an complicated. There must be a simple way to just have java play an mp3 file. Can someone point me in the right direction.



  2. #2
    gimbal2 is offline Just a guy
    Join Date
    Jun 2013
    Rep Power

    Default Re: Play mp3

    MP3 files are a bit iffy anyway because there is a license bound to it; in that respect OGG is a better choice since it is completely open.

    The first hit in my Google for "java mp3" returns this stackoverflow thread which suggests to use JavaFX for it:

    audio - Playing .mp3 and .wav in Java? - Stack Overflow

    Seems like a nice way to do it without needing third party stuff. The only limitation is that you need at least Java 7 to be able to use your application; not an unfair requirement in this day and age.
    "Syntactic sugar causes cancer of the semicolon." -- Alan Perlis

Similar Threads

  1. how i could make this play ,please?!!
    By MonDo021 in forum AWT / Swing
    Replies: 2
    Last Post: 04-30-2011, 02:59 PM
  2. To play wav or mp3
    By jomla in forum Java Applets
    Replies: 2
    Last Post: 03-07-2011, 09:19 PM
  3. play() and mp3
    By willemjav in forum Advanced Java
    Replies: 3
    Last Post: 12-23-2007, 03:50 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts