Sound not working.Help pls

When i click on a button it should play sound.But its not playing sound.Can anyone pls help me????
     public void stringToAudio(String audioFile){
          try{
               audioURL = new URL("file:" + new File(".").getCanonicalPath()+"/"+audioFile);
               audioClip = Applet.newAudioClip(audioURL);
               audioClip.play();
          catch(Exception e){
               System.out.println(e.toString());
ch1Button.addActionListener( new ActionListener() {
               public void actionPerformed(ActionEvent e) {
                    if(AnsArray==1){
                         stringToAudio(audioFileName1);
                         score+=1;
                         System.out.println("score is");
                         System.out.println(score);
                         correctAns=tk.getImage("D:\\cs170java\\correctBoy.gif");
                         nextButton.setEnabled(true);
               } //end of if selectedButtonNumber
               else{
                         nextButton.setEnabled(false);

why no one is not helping?Pls guys help meDon't say things like that.
It looks like your URL is wrong. Basically you are trying to construct a URL in a bit of a dodgy way. Why don't you just create a File object that corresponds to the audio file (clue: you don't need to give it a full path, as it looks like the file is in the same relative path as the class anyway, due to your use of '.'), by just giving it the filename, then do File.toURL() to get the URL, and pass this in to Applet.play(). Your code would be far simpler, and hey might even work. Read the APIs.
HTH

Similar Messages

  • Sound not working - help!

    Hardware Overview:
    Model Name: iBook G4
    Model Identifier: PowerBook6,5
    Processor Name: PowerPC G4 (1.1)
    Processor Speed: 1.33 GHz
    Number Of CPUs: 1
    L2 Cache (per CPU): 512 KB
    Memory: 256 MB
    Bus Speed: 133 MHz
    Boot ROM Version: 4.8.7f1
    now, i've been experiencing some odd things regarding the sound. sometimes when i boot, i can hear the boot chime, and then in osx hear sounds while moving the volume slider up/down. but sometimes, like today, all i can hear when i play music or simply slide the volume knob is a sound like a hiss, like an old broken radio,,
    i never seen this in my life happening on a mac.. have you guys?
    i also tried to do a pmu and a nvram reset .. it didn't worked. still the same problem..
    help!

    why no one is not helping?Pls guys help meDon't say things like that.
    It looks like your URL is wrong. Basically you are trying to construct a URL in a bit of a dodgy way. Why don't you just create a File object that corresponds to the audio file (clue: you don't need to give it a full path, as it looks like the file is in the same relative path as the class anyway, due to your use of '.'), by just giving it the filename, then do File.toURL() to get the URL, and pass this in to Applet.play(). Your code would be far simpler, and hey might even work. Read the APIs.
    HTH

  • My iphone 5 keyboard, lock, alrets sounds not working. help me!

    please help me, I can't solve this

    Hey there yakenni,
    Welcome to Apple Support Communities.
    It sounds like there’s an issue launching the iTunes Store app on your iPhone, you’re tapping it and nothing is happens. Try some of the general iOS app troubleshooting suggestions in the article linked below.
    If an app you installed unexpectedly quits, stops responding, or won’t open - Apple Support
    Restart the app
    Close the app and open it again.
    Restart your device
    Turn your device off and back on.
    Check for iOS and app updates
    Make sure that you're using latest version of iOS.
    Also, you can always restore your iOS device to factory settings as shown here:
    Use iTunes to restore your iOS device to factory settings - Apple Support
    Ciao,
    -Jason

  • My open new tabs in new window option IS NOT working, help pls.

    i used ccleaner, now even though the open new tab in new window box is checked, it doesnt. i have reloaded Firefox and still it doesn't. Pls advise....

    Triple-click the line below to select it:
    ~/Library/Preferences/com.apple.Safari.plist
    Right-click or control-click the highlighted line and select
    Services ▹ Show Info
    from the contextual menu.* An Info dialog should open.
    Does the dialog show "You can read and write" in the Sharing & Permissions section?
    In the General section, is the box labeled Locked checked?
    What is the Modified date?
    *If you don't see the contextual menu item, copy the selected text to the Clipboard (command-C). Open a TextEdit window and paste into it (command-V). Select the line you just pasted and continue as above.

  • I have a 2010 Macbook Pro and am a very new user to Mac community. My Mac is just hanging and I am unable to shut it down or do anything at all.  I left it for 2.5 days hoping the battery will run flat but it is not working. Pls help! I am desperate. Tx

    I have a 2010 Macbook Pro and am a very new user to Mac community only started to use this PC a few weeks ago.
    My Mac is just hanging and I am unable to shut it down or do anything at all.  I left it for 2.5 days hoping the battery will run flat but it is not working. Pls help! I am desperate. Tx

    In order to resolve the issue if it occurs again, more info would be helpful as to what occurred prior to the "hang." One potential fix would be to try a Safe Boot:
    After the Mac is completely shut down, push the power button and immediately after the startup tone, hold down the Shift key. The Shift key should be held as soon as possible after the startup tone but not before.
    Release the Shift key when you see the gray Apple icon and the progress indicator (looks like a spinning gear).
    There should be a message that says "SafeBoot." After the Mac is completely booted, try restarting and see if the issue is gone.

  • I have a problem with iphone 4s...is ringing but another sounds not working....please help me!!!

    i have a problem with iphone 4s...is ringing but another sounds not working....please help me!!!

    Hi pystyke,
    Welcome to Apple Support Communities.
    You may find these links helpful with troubleshooting the audio issue you're experiencing:
    iPhone Assistant
    http://www.apple.com/support/iphone/troubleshooting/
    iPhone: Hardware troubleshooting
    http://support.apple.com/kb/TS2802
    Best,
    Jeremy

  • My video recording sounds not working but other sounds are working fine, I've tried clearing the little mic thing near my earphone hole and had no success can someone please help me out?

    hhi guys
    my video recording sounds not working at all but it's working for other things such as music. I've tried to clear my sound thing near the earphone hole but had no success can someone please help me out?

    Had an Iphone 4 for about 3 months now. This happened to the first one I had and they ended up having to replace it at the apple store just a couple weeks ago 6/2. It happened again last night to my new one. This time i was able to correct it by going to itunes, backing up the phone to icloud, and then restoring the software. Mine did not work with voice memo, but did work with headphones plugged in, and would also work on speaker. I could hear callers but they couldn't hear me. I had purchased a new case (lifeproof case at $79.99) because it comes with plugs that cover the headphone jack, and the charging port, and is also waterproof. I heard that the root cause is due to lint, dirt, etc getting inside the headphone jack. Well, must be something else. It's a 10 days old phone, and has been in this overpriced case the whole time, and I have not used the headphones. I hope this doesn't keep happening.

  • Soundblaster X-Fi Surround sound not working!!!! HELP!!!!

    9Soundblaster X-Fi Surround sound not working!!!! HELP!
    !!! officially i hate creative to the what was supposed to be simple registration which in itself annoyed me to now the speakers i have been using for a longggg time for the past 4 days has been bothering me..
    Using a Creative Soundblaster X-fi ?sound card with a 7. surround sound speaker set-up and windows vista ultimate (32bit) the sound refuses to come out of all the speakers during the channel test it sometimes picks up certain speakers but never all of them and the sound is pretty much coming out of the left speaker only i've tried uninstalling all the drivers installing every driver i can find together with the console launchers i've changed the config settings in windows itself which doesnt help uninstalled all codecs bought another x-fi card (i was getting frustrated) still nothing the only thing i havent done is re-install windows which i refuse to do because of some creative defect!
    I hope someone has a solution or any advice would help i've also used dri've cleaner and sweeper to clear all data from the registry etc rebooted etc etc etc still no luck....
    Sort it out creative!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! !!!!!!!!!!!

    **beep** !! a response would be GREAT............
    Admin Notes: I understand that you are frustrated but cursing & swearing is not allowed here. If you need help from customer support, you can contact them through email. Please abide to the rules if you want to participate in this forum.
    Message Edited by KokChoy-CL on <span class='local-date'> 02-7-2009<span class='local-time'> 09:50 [email protected]

  • HELP iPad mini sound not working

    We just bought our daughter her iPad mini today and the sound just stopped working. It'll only work with headphones; we never put headphones in prior to the sound not working. I tried resetting the phone and phone settings several times, as well as plugging in and out headphones. I changed the switch on the side to lock rotate. I also turned off the mono sound thing. I am at a loss as to what else there is to do. Any other suggestions? I've been at this for a couple of hours now trying to fix her iPad. Please help!

    Do you get sounds in any apps on the iPad ?
    If you get sound in the Music and Videos apps but not others then have you got notifications muted ? You say that you changed the side switch to rotation lock, but are sounds muted ? The switch on the side of the iPad controls either rotation or mute, the function that it isn't controlling is set via the iPad's control centre : swipe up from the bottom edge of the iPad's screen and it's the right-most of the 5 icons in the middle of it (if the icon is white then it's 'on', tap it to turn it grey and 'off').
    Notification mute and rotation lock : http://support.apple.com/kb/HT4085

  • Sound is off in iphone 4.. Speaker mic all sound not working in iphone 4.. What i do? Any help me!!!!

    Sound is off in iphone 4.. Speaker mic all sound not working in iphone 4.. What i do? Any help me!!!!

    Get a new SIM from your carrier.

  • AUDIODG.EXE hogging 80-100% of CPU and sound not working in Vista . . .

    I posted this on a Microsoft Answers Forum but none of the techs or people reading have been able to help so far.  I'm dying to get to the bottom of this:
    Here is my computer:
    MSI K8N Neo4 Platinum
    AMD Athlon 64 3000+
    2GB RAM
    XFX GEFORCE 6600 GT 128MB DDR3 DUAL DVI & TV OUT (PCI-E)
    200GB WD SATA HDD
    500GB WD HDD in external enclosure via USB2
    NEC ND-3520A 16X DVD±RW Dual Layer DVD Burner
    LG CD Burner
    I've been using Vista Home Premium successfully for some time.  Recently, not too long after I did a clean wipe of my OS, my audio would stop working.  The way it would happen is that everything would work fine until I started iTunes or another audio application and when I would hit play, things would lock up.
    Upon inspection of my system resources, I'm noticing that the audio platform for Vista, via the audiodg.exe, is using close to 100% of my CPU resources, even when the computer is making no sound at all.
    I've had a Sound Blaster Live! card in my computer for some time but I was not using it; I use the Realtek AC'97 audio drivers that are on my motherboard instead.  I thought that the conflict may be the computer wanting to recognize my Sound Blaster, so I took it out of my computer but the problem seems to be worse.
    Are there any BIOS setting that need to be adjusted for my sound to start working again?
    I'm very reliant on the audio processing power of my computer (I'm in the radio industry, part-time) and this is a huge drag on my productivity.
    Any tips would be much appreciated.
    REPLY #1:
    Thank you for using Microsoft Answers forum.  I suggest going to the manufacture of your sound card and download the latest drivers and install them.
    MY RESPONSE:
    Good suggestion.  The problem is this:
    I am running on-board audio.  I have an MSI K8N Neo4 Platinum motherboard which runs "Realtek ALC Series AC97 Audio Driver" and there is no version for Vista. They have a version for Windows 2K/XP and one for Windows XP 64bit.
    Should I use on of those and if not, then what?
    UPDATE (from me):
    I took a chance and found a Realtek AC'97 driver for Vista.
    http://drivers.softpedia.com/progDownload/Realtek-AC-97-Audio-Codec-Driver-Vista-6183-Beta-Download-18114.html
    I went to install it and the install hung.  So, I closed one of the install windows and then the InstallShield app continued like it was working.  So, I hit "Restart my computer".  Well, the reboot hung too.  So, I reset the PC manually.
    When the computer came back up, the sound worked.  Hard to tell if this will fix it for good but it's promising.  Chaotic.  Unpredictable.  Annoying.
    REPLY #2:
    Before you tried updating drivers, did you try rebooting 1st?
    I'm just trying to determine if rebooting your system is what resolved the issue - thank you
    UPDATE II (from me):
    My computer is behaving the same way it was before.  AUDIODG.EXE taking up 80-100% of my CPU and the sound not working.
    Any other ideas?

    Small update: Despite my intelligence, good looks and vast experience I use Google sometimes. To my surprise this file turns out to be a Windows one. Here is someone who is much happier, and since it is some way in my line of thinking I'll quote it, but you might take my previous advice as well:
    http://forums.techarena.in/windows-vista-performance/1012315.htm
    "- Open up msconfig.exe > Manage startup programs.
    - Disable ALL Realtek entries
    - Close msconfig.exe
    - Right-click on the speaker icon > Audio devices > Speakers (properties)
    - Go to the enhancements tab
    - Check the box to disable all audio enhancements
    - Close the menu
    - Right-click on the speaker icon > Recording devices
    - Disable all your microphones (yeah..., the actual problem seems to come
    from voice inputs rendering..)
    - Close the menu
    - Restart your computer"

  • Sound not working Notebook Envy 15 TS windows 8 and windows 8.1 - problem continues

    Hello,
    My computer sound stopped again.
    I posted previously: 
    http://h30434.www3.hp.com/t5/Notebook-PC-Sound-and-Audio/Sound-not-working-Notebook-Envy-15-TS-windo...
    After I`ve followed David`s  steps my computer`s sound started working again. But it didn`t last. The sound stopped working just one day after.
    I did the procedure again, and it worked. But just for a few hours.
    The second time I reinstalled the IDT codec I noticed at the device manager that there is no conflict at the IDT High Definition Audio CODEC.
    Instead, the conflict appear in another item of the sound, video and game controllers topic: high definition audio device.
    Is there another codec I should reinstall?
    Could anyone help me?
    Regards,
    Luiz

    As nobody asked me yet, I`m going to provide some additional information, hoping this can help getting me some help!
    The properties device shows the following log:
    This device cannot start. (Code 10)
    {Operation Failed}
    The requested operation was unsuccessful.
    Driver provider: Microsoft
    Driver date: 22/08/2013
    Druver versuib: 6.3.9600.16384
    Digital Signer: Microsoft Windows
    The Driver File Details shows the following driver files:
    C:\WINDOWS\system32\drivers\drmk.sys
    C:\WINDOWS\system32\drivers\HdAudio.sys
    C:\WINDOWS\system32\drivers\ksthunk.sys
    C:\WINDOWS\system32\drivers\portcls.sys
    C:\WINDOWS\system32\SysFxUl.dll
    C:\WINDOWS\system32\WMALFXGFXDSP.dll
    Beyond this files above listed, the driver details sogs these informations:
    Provider: Microsoft Corporation
    File Version: 6.3.9600.16384 (winblue_rtm.130821-1623)
    Copyright: (c) Microsoft Corporation
    Digital Signer: Microsoft Windows
    More information:
    If I ask to Ubdate Driver, with automatic serch engine, I get a message saying the best driver software for me is already installed and that mine driver software for the "High Definition Audio Device" is up to date.
    Can anyone help me now?
    Thanks,
    Luiz

  • I have a problem with my Iphone 5 all sounds not working

    sounds not working at all with my iphone 5.

    Hi Ali147,
    Welcome to the Support Communities!
    The following article will provide some troubleshooting steps for this issue:
    iPhone: Can't hear through the receiver or speakers
    http://support.apple.com/kb/TS1630
    Hope this helps ....
    Judy

  • IPad sound not working

    iPad sound not working. Need help

    Is it working on any apps e.g. Music and Videos apps but not third-party apps or notification sounds ? If you do get sound in Music and Videos then have you got notifications muted ? Only notifications (including games) get muted, so the Music and Videos apps, and headphones, still get sound.
    Depending on what you've got Settings > General > Use Side Switch To set to (mute or rotation lock), then you can mute notifications by the switch on the right hand side of the iPad, or via the taskbar : double-click the home button; slide from the left; and it's the icon far left; press home again to exit the taskbar. The function that isn't on the side switch is set via the taskbar instead : http://support.apple.com/kb/HT4085

  • I have pavilion dv6 sound not working hp provide new update idt stil not working

    HI .
    i have pavilion dv6 sound  not working hp provide new update idt stil not working

    Go to the link below.Enter your Product Number as listed on Service Tag attached to bottom of notebook (may be under battery). You can also get the Product Number by pressing Fn + Esc key. After entering PN, click Next ,then choose Software & Drivers.On the next page use the dropdown to select your OS (probably Windows 7 64bit). A list will populate with drivers. Download & Save the latest Audio driver.
    http://h10025.www1.hp.com/ewfrf/wc/siteHome?cc=us&lc=en
    Go to Control Panel,Programs & Features-Uninstall IDT software and restart the laptop.Next install using the downloaded file.
    ```````````````````````````````````````
    If still no sound,try a hard reset, works sometimes.Disconnect all external devices first.
    1-remove power cord and battery
    2-press power button for 30 seconds
    3-reinstall only power cord for first startup.
    4-power on
    ******Clicking the Thumbs-Up button is a way to say -Thanks!.******
    **Click Accept as Solution on a Reply that solves your issue to help others**

Maybe you are looking for