3 Replies - 3644 Views - Last Post: 17 May 2011 - 03:40 PM Rate Topic: -----

#1 xhying94  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-May 11

Problem with playing MP3 files in Eclipse (Java)

Posted 17 May 2011 - 02:28 PM

I am currently doing my end of the year project for computer science, and I am making Super mario. I got everything to work and since I have 2 more days, I want to enhance the codes so that it will play music. I downloaded the super mario theme song in mp3 format, and downloaded the javalayer jar file, and imported
 
import javazoom.jl.player.Player;


i then named the song Super.mp3, (short for super mario theme which will be a pain to type) and then in the client program, i had
String name = "Super.mp3";
MP3 music = new MP3(name);
music.play();


somehow whenever i run the program, it gives me errors saying:
"Problem playing file Super.mp3
java.io.FileNotFoundException: Super.mp3 (The system cannot find the file specified)
java.lang.NullPointerException"

Super.mp3 is in the same package as the client program, and it is driving me nuts!!!
Thanks for helping:)

Is This A Good Question/Topic? 0
  • +

Replies To: Problem with playing MP3 files in Eclipse (Java)

#2 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Problem with playing MP3 files in Eclipse (Java)

Posted 17 May 2011 - 03:26 PM

Never used that library, but the error is telling you that it cannot find your file (As you already know). Make sure its completely correct in terms of spelling and case. I have looked into the library, and there seems to be more work to playing an mp3 to what your doing. Take a look at this example, just ignore the threading part
HERE
Was This Post Helpful? 0
  • +
  • -

#3 xhying94  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 2
  • Joined: 17-May 11

Re: Problem with playing MP3 files in Eclipse (Java)

Posted 17 May 2011 - 03:32 PM

Thanks, but i checked the spelling and all that for the song, and since the error is telling me that eclipse cannot find the song, which is certainly sitting in the project folder. And i will look into that today!
Thank you for replying.
Was This Post Helpful? 0
  • +
  • -

#4 nick2price  Icon User is offline

  • D.I.C Lover
  • member icon

Reputation: 561
  • View blog
  • Posts: 2,826
  • Joined: 23-November 07

Re: Problem with playing MP3 files in Eclipse (Java)

Posted 17 May 2011 - 03:40 PM

One thing you could try is giving the full path to the file on your hard drive e.g C://.....
Was This Post Helpful? 0
  • +
  • -

Page 1 of 1