Whenever I try the audio clip, I get this error:
java.net.MalformedURLException: no protocol: /Users/videogames/Documents/workspace/TryApplets/res/adv.wav---------
What's the problem? Here's the code for the program. (I use a mac, if that matters at all)
package game;
import java.applet.*;
import java.net.*;
public class sound {
/**
* @param args
*/
public static void main(String[] args) {
try {
URL url = new URL("/Users/videogames/Documents/workspace/TryApplets/res/adv.wav");
AudioClip clip = Applet.newAudioClip(url);
clip.play();
} catch (MalformedURLException murle) {
System.out.println(murle);
}
}
}
An URL must start with something like
http://..
orfile://..
. The URL shown does not, it is not a valid URL.