i m not getting how to play a mp3 file using applet? i m using AudioClip A = getAudioClip(x); where x is --> URL x=C:\'Users\'gourav\'java_pr; its just a try! i donot know how to use this. it is showing error. tell me how to use audioclip interface?

"It is showing error" is not helpful to anyone. If you want help resolving an error, you need to post what it is.

You also need to read the forum rules about using clear, relevant titles for your threads. "problem!" is not a useful title.

Post the code and the exact error message. PLEASE use the [ CODE ] tags.
Thanks.

"It is showing error" is not helpful to anyone. If you want help resolving an error, you need to post what it is.

You also need to read the forum rules about using clear, relevant titles for your threads. "problem!" is not a useful title.

public void paint(Graphics g)
    {
        URL url = getDocumentBase();
        //URL x="C:\Users\gourav\java_pr";
        l=url.toString();
        g.drawString(msg,50,20);
        g.drawString(l,200,200);
        showStatus("hello!whats upp!!");
        g.drawString(""+ i,100,100);
try{
                    AudioClip A = getAudioClip(new URL("C:\'Users\'gourav\'java_pr"));

        }catch(Exception e)
                {

    }
        A.play();
    }

this is my function in which i am using audio to be played. it is a applet program. the class in which this function is declared has extends applet class.now,

C:\Users\gourav\java_pr\app.java:60: error: cannot find symbol
        A.play();
        ^
  symbol:   variable A
  location: class app
1 error

Tool completed with exit code 1

this is the error coming when i compile this .java file. now your all question are solved. now please tell :'(

problem with scope
you're declaring and initializing A within your try block.
put the A.play();
call also in the try block

problem with scope
you're declaring and initializing A within your try block.
put the A.play();
call also in the try block

i have somewhere that applet supports only ".au" files. is it true ?? and should i given full path or only the name of .mp3 file in URL ?

very well possible.
playing .mp3 files is not standard supported in Java.
if you want to play .mp3 files, you can use (for instance) JMF (Java Media Framework), or, what I would recommend, since it's quite easy and all you need to do is add a single .jar file to your classpath, the jLayer library which you can find here.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.