Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17


Java Sound Problems............

Posted on 2002-04-11
Medium Priority
Last Modified: 2011-09-20
As far as i can see this code is correct but the sound is not being played when the button is pressed!

here is all the code involved

public void mousePressed(MouseEvent event)
Object source = event.getSource();
if (source == cotbuttons[0])

public void WellDoneSound()
URL welldoneurl = new URL("file://C:/Java/FYP/sounds/welcome.wav");
AudioClip welldoneclip = JApplet.newAudioClip(welldoneurl);;
catch (MalformedURLException e){}

please help if you can!!!!!!!!!

thank you

Question by:Codster
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Accepted Solution

Venci75 earned 20 total points
ID: 6933789
It is OK, but probably the code inside the if(source == cotbuttons[0]) is not executed.

What about the

Author Comment

ID: 6933929
the code is being executed all right have System.out.println("xxxx"); statements everywhere
the import; statement is ok as well
everything seems to be executing only the sound is not being played.

Why do  i not need import javax.sound etc etc?
the file type i am using is a .wav
is there anything involved in that that i have omitted?
LVL 92

Expert Comment

ID: 6935363
The answer to your previous question obviously answered your question, so award the points to Venci75.
LVL 92

Expert Comment

ID: 6935397
I meant the previous question, not this one :)

Author Comment

ID: 6935401
Thank you
i will award him the points
can you help me with my problem at all?

Featured Post

Important Lessons on Recovering from Petya

In their most recent webinar, Skyport Systems explores ways to isolate and protect critical databases to keep the core of your company safe from harm.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Java had always been an easily readable and understandable language.  Some relatively recent changes in the language seem to be changing this pretty fast, and anyone that had not seen any Java code for the last 5 years will possibly have issues unde…
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Viewers will learn about if statements in Java and their use The if statement: The condition required to create an if statement: Variations of if statements: An example using if statements:
Viewers will learn how to properly install Eclipse with the necessary JDK, and will take a look at an introductory Java program. Download Eclipse installation zip file: Extract files from zip file: Download and install JDK 8: Open Eclipse and …
Suggested Courses

688 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question