Skip to Main Content

Java SE (Java Platform, Standard Edition)

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Cannot play wav sounds in java

843806Jul 22 2007 — edited Jul 22 2007
I have a simple program that will play the wav files when executed. But the sound doesnt play. Here is the code
import javax.swing.*;
import java.awt.*;
import java.net.*;
import java.beans.*;
import java.io.*;
import java.applet.*;
import java.awt.event.*;


public class test extends JPanel
{
	
	
	
	
	
public static void main(String args [])
{
	try{      
            		
            		URL dance = new URL("file:res/hallelujah.wav"); 
            		AudioClip danceClip = Applet.newAudioClip(dance); 
            		danceClip.play();
            	} catch (Exception e)
            	{      
            	 	e.printStackTrace();    
            	}  
	
}	
	
	
	
Can anyone the error? Thanks
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Aug 19 2007
Added on Jul 22 2007
1 comment
97 views