File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes  Playing sound in Java Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark " Playing sound in Java " Watch " Playing sound in Java " New topic

Playing sound in Java

Kunal Goswami

Joined: Oct 15, 2013
Posts: 2
I am learning programming in java. I read about the clip() method, and I passed a file in my C:/My Music folder as the url, it shows no exception but no song is played. I have the song.wav file at the specified path. But I do not hear any sound when I run this program. I use Eclipse IDE, at first I specified the path as " C:/My Music/song.wav" but it showed an exception of unknown protocol, hence I added file://C:... to the path, yet I do not hear any sound, I want to make a program which while running plays this song.wav as background music. Please help me and guide me on what to do?

Here's the code ( only for playing the song )
Nam Ha Minh
Ranch Hand

Joined: Oct 31, 2011
Posts: 502

I think the AudioClip is only working with a Java applet which is embedded in a web page.
In your case, using it in a stand-alone program wouldn't be possible.

PM Me If You Want to get Urgent Help on Java Programming
Ulf Dittmer

Joined: Mar 22, 2005
Posts: 42965
Yep, AudioClip is not the way to go. A quick search found
I agree. Here's the link:
subject: Playing sound in Java
It's not a secret anymore!