Having problem making my program play the sound i want it to play...

Ok, im new at this so bare with me (and my spelling)...
i've been trying to make my program play a musicfile during the actual program... and trust me, i've tried so many times...
after the last try i get the errormessage "cannot find symbol" for 2 things...
import javax.swing.*;
import javax.sound.sampled.*;
import java.io.*;
     public class iwish {
          public static void main (String args[]) {
               AudioClip sound = JApplet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish1.wav"));
               sound.play( );
               String a = JOptionPane.showInputDialog("Vem kan du vara?");
               String b = JOptionPane.showInputDialog("Jaha " + a + ", sommar eller vinter d??");
               String c = JOptionPane.showInputDialog("Vem vill du helst av allt ha bredvid dig nu?");
               String d = JOptionPane.showInputDialog("D? f?rst?r jag, glass eller choklad (du f?r bara v?lja ett f?rslag)?");
               String e = JOptionPane.showInputDialog("Vart f?redrar du att sova d? (gl?m inte prepositionen)?");
               String f = JOptionPane.showInputDialog("Ok, om du korsar fingrarna, l?gger du pekfingret under eller ovanp? l?ngfingret?");
               JOptionPane.showMessageDialog(null, "Ok, jag kommer fram till tv? alternativ:");
               JOptionPane.showMessageDialog(null, "Alt 1; " + a + ", p? din " + b + "semester har du helst sex \n med " + c + " " + e + " samtidigt som du ligger " + f + " " + c + " som \n f?rsiktigt slickar " + d + " fr?n din kropp, tills hela din kropp skakar av njutning!");
               JOptionPane.showMessageDialog(null, "Alt 2; Du f?redrar ingen speciell ?rstid eller speciellt st?lle \n att ha sex p?, s? l?nge du f?r ha det med " + c + ". Sedan f?r du \n somna i " + c + "s famn. Glass och choklad kan du alltid f? n?r du vill!");
               System.exit(0);
the problem is: iwish.java:10: cannot find symbol
symbol : class URL
location: class iwish (at the U) ^
AudioClip sound = JApplet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish1.wav"));
^
am I making any sense?! =) what have i done wrong?

ok, thank you,
i tried it with the catchphrase and the program worked just as it did when I threw the exception...
import javax.swing.*;
import javax.sound.sampled.*;
import java.io.*;
import java.net.*;
import java.net.URL.*;
import java.applet.*;
import java.applet.AudioClip.*;
     public class iwish {
          public static void main (String args[]) {
               try
               AudioClip sound = Applet.newAudioClip(new URL("file://C:\\Program\\Java\\jdk1.6.0_02\\bin\\iwish3.wav"));
               sound.play();
               catch (MalformedURLException j)
               j.printStackTrace();
I changed the "e" to a "j" in the "catch (MalformedURLException j)" since I was using the e in one of my strings...
Was it supposed to work or did I do wrong? =/

Similar Messages

  • I'm having problems with facebook notifications.  The sound doesn't work but shows up in banner.  Any suggestions?  I've tried everything but restoring.  Is it a phone problem or an app problem?

    I am having a problem with facebook notifications.  The sound doesn't work but appears as a banner.  I've tried everything but restoring the phone.  Is this a phone problem or an app problem?  Has anybody experienced this problem and were they able to correct it? 

    1) This is because of software version 1.1. See this
    thread for some options as to how to go back to 1.0,
    which will correct the problem...
    http://discussions.apple.com/thread.jspa?threadID=3754
    59&tstart=0
    2) This tends to happen after videos. Give the iPod a
    minute or two to readjust. It should now be more
    accurate.
    3) This?
    iPod shows a folder icon with exclamation
    point
    4) Restore the iPod
    5) Try these...
    iPod Only Shows An Apple Logo and Will Not Start
    Up
    iPod Only Shows An Apple Logo
    I think 3,4, and 5 are related. Try the options I
    posted for each one.
    btabz
    I just noticed that one of the restore methods you posted was to put it into Disk Mode First rather than just use the resstore straight off, I Have tried that and seems to have solved the problem, If it has thank you. previously I have only tried just restoring it skipping this extra step. Hope my iPod stays healthy, if it doesnt its a warrenty job me thinks any way thanks again

  • I am having problems updating my itunes to the latest version, on each stage I am getting a message 'The feature you are trying to use in on a network resource that is unavailable.'  I try to click OK it fails and I do not know an alternate path to select

    I am having problems updating my itunes to the latest version, on each stage I am getting a message 'The feature you are trying to use in on a network resource that is unavailable.'  I try to click OK it fails and I do not know an alternate path to select, please help?
    I get message like below on each stage of the update, Quicktime, Safari & iTunes;
    It's so annoying as until I update my iTunes account my phone won't sync.

    Many thanks for the screenshot. (The key to these is knowing which particular .msi file is being mentioned by the message.)
    (1) Download the Windows Installer CleanUp utility installer file (msicuu2.exe) from the following Major Geeks page (use one of the links under the "DOWNLOAD LOCATIONS" thingy on the Major Geeks page):
    http://majorgeeks.com/download.php?det=4459
    (2) Doubleclick the msicuu2.exe file and follow the prompts to install the Windows Installer CleanUp utility. (If you're on a Windows Vista or Windows 7 system and you get a Code 800A0046 error message when doubleclicking the msicuu2.exe file, try instead right-clicking on the msicuu2.exe file and selecting "Run as administrator".)
    (3) In your Start menu click All Programs and then click Windows Install Clean Up. The Windows Installer CleanUp utility window appears, listing software that is currently installed on your computer.
    (4) In the list of programs that appears in CleanUp, select any Bonjour entries and click "Remove", as per the following screenshot:
    (5) Quit out of CleanUp, restart the PC and try another iTunes install. Does it go through properly this time?
    (Assuming that the QuickTime and Safari messages were also citing bonjour64.msi, you should also then be good to go with those installs too.)

  • Anyone else having problems making a hyperlink to a file in CS4?

    Anyone else having problems making a hyperlink to a file? 
    I have a document in CS4 that I'm exporting to pdf. When I create a hyperlink in CS4 to a file, I am getting the message when I click the link in the pdf ' Cannot find the file:C%5Document' etc. 
    When creating the link, File is selected, Shared Destination is unchecked & checking the link using 'Go to Destination' shows the link works. 
    In Acrobat 9 Pro, I've checked the properties of the link - when exported from CS4, the Link Properties - Actions are 'Open a web link' 'file:C:\Documents%20'etc whereas if the link is created in Acrobat the link properties are ' 'Open a file' 'file:C\Documents and Settings' etc, and it works. 
    Is this a bug or am I missing something?

    I'm only getting that to work with the catalogue & sample in the same folder. In any case from a useability standpoint using URL brings up the Security Warning & putting the catalogue pdf in the same folder as 100 sample pdfs makes it more difficult to locate.
    I'm at a loss to understand why the functionality of creating a link in InDesign cannot be the same as Acrobat; where you can select 'Open a file', browse to that file and the relative links are maintained when you burn to a disc. InDesign looks as if it will do the same but when you select File as the link & browse to the destination file but InDesign treats it as a URL & brings up the the web link cursor in the finished pdf. That still looks like a bug to me.

  • Am I the only one having problems with ringer volume since the update?

    Am I the only one having problems with ringer volume since the update?? I'm hard of hearing and before updating to IOS7 I could hear my alarm and ringer just fine. Volume is turned up all the way and I've chosen the loudest sounds I could and still having a difficult time hearing.

    Annie Hall is available on DVD only.
    It is not available for streaming and I believe movies available for streaming are the only movies available with the Netflix app on an iOS device.

  • Having problem making purchases in game? Credit Card set up and previously made many purchases.

    Having problem making purchases in game? Credit Card set up and previously made many purchases.

    What happens when you try to buy them, does the 'buy' button not work, do you get any error messages ... ?
    If you are getting a message to contact iTunes Support then you can do so via this link and ask them for help (we are fellow users here on these forums, we won't know why the message is appearing) : http://www.apple.com/support/itunes/contact/ - click on Contact iTunes Store Support on the right-hand side of the page, then Purchases, Billing & Redemption
    If it's a different problem ... ?

  • Hi all. I recently restore my old iphone 5 on my new 6. I'm having problems with bluetooth devices. The ones that were already paired with the old one are not showing in the list, and most of them(not all) are not working or pairing. I already restod

    Hi all. I recently restore my old iphone 5 on my new 6. I'm having problems with bluetooth devices. The ones that were already paired with the old one are not showing in the list, and most of them(not all) are not working or pairing. I already restored network settings to no avail. Any ideas?

    What's more, they don't even show on the bluetooth devices list..

  • Having problem with my app on the Iphone 4

    i recently buy an iphone 4 but lately i been having problem with all app on the iphone i can't enter app store, facebook, tweeter etc and when i try to log off my account it actually don't let me log off i even do a recent to the iphone 4 and yet not letting me do a thing!

    some help please!

  • After downloading iOS7, I'm having problems with typewriting Korean in the apps such as the Pages and Keynote.

    After downloading iOS7, I'm having problems with typewriting Korean in the apps such as the Pages and Keynote.
    When I type "한글", it should appear as such but it appears as "하 ㄴ 그 ㄹ"

    Report this to apple via
    http://www.apple.com/feedback

  • Had to remove itunes from my computer to reset the computer. Now I'm having problems syncing my iphone with the computer. Computer is saying it wants to download updates to the phone but that will delete things I downloaded straight from the phone. Help!

    Had to remove itunes from my computer to reset the computer. Now I'm having problems syncing my iphone with the computer. Computer is saying it wants to download updates to the phone but that will delete things I downloaded straight from the phone. Help!

    iTunes thinks you have a new computer because you restored the OS. Open iTunes and authorize it to the same account you have on the iPhone. Did you restore your iTunes content from a backup after resetting your computer? Have you been syncing regularly with the computer, and does the iTunes library on the computer contain your apps, music and videos? If so just sync and your content will be removed then restored.
    If you have not hopefully you have now learned something. You can recover apps and purchased songs by connecting the phone, without syncing, and choose "Transfer purchases..." from the File menu.

  • I am having problems loading sampler patches into the exs24 sampler, when i got into edit menu and load multiple samples all the samples r greyed out and i cannot slect them, any help with this would be much appreciated

    I am having problems loading sampler patches into the exs24 sampler, when i got into edit menu and load multiple samples all the samples r greyed out and i cannot slect them, any help with this would be much appreciated

    It is very difficult to offer troubleshooting suggestions when the "os version" you are using is unknown as each os has their own troubleshooting solutions. 
    How large is your hard drive and how much hard drive space do you have left? 

  • I am having problems accessing my airport utilities, the area which allows me to alter settings is all greyed out. Can anyone help?

    I am having problems accessing my airport utilities, the area which allows me to alter settings is all greyed out. Can anyone help?

    Using the same Ethernet cable that is used to connect the modem to the AirPort Extreme, disconnect the Ethernet cable from the AirPort Extreme and connect it directly to your Mac as a test for 4-6 hours.
    Be sure to power off the modem for 5-10 minutes when you do this, so that it will associate with the new device that it "sees".
    Does the connection drop when you connect this way? If yes, then replace the Ethernet cable and run the test again for 4-6 hours.
    If the connection still drops, you likely have a defective modem or a line problem on the cable service....despite what the cable company might say.
    If the connection remains solid when you run the "test", then you know that the modem and Ethernet cable are working correctly.
    If you have performed a factory default reset on the AirPort Extreme a few times, and connection still drops, then you should take the AirPort to an Apple Store....if you have one near you..... to let them take a look, or contact Apple Support directly.
    http://www.apple.com/support/contact/

  • Having problems with front row (and the opticle drive)

    I bought my macbook three days ago, and I'm already having problems. First off, I transfered music from my user profile on my old iMac G5 to the macbook via data DVD. My music collection had some purchaces from the itunes store, so I had to go through the authorization thing, and I can now play them just fine in the iTunes library, but the problem is, if I try to use the front row program to play my purchaced music, I get the message saying that I have to authorize it first. What the ****? Does anybody else have this problem? Also, like many other macbook users, I'm having problems with the opticle drive, such as getting cds to be recognized and other things of that nature.

    I noticed that this problem started after I tried to use a software to unlock my drive's region...
    I believe this is the problem. The VLC Media Player will usually play DVDs from other regions without changing the settings on your optical drive. You may need to reset your optical drive's firmware back to the original setting, make sure you have the region set for the one you'd prefer to use the most and then use VLC to play the other DVDs.
    -Doug
    P.S. After two years in the Front Row forum, I'm not sure I've ever heard of anyone playing HDDVD_TS folders with Front Row. I'm not saying it won't work, but I'm not sure it's really supported either. I do have DVD Studio Pro myself, but I'll have friends or family staying with me for nearly the next month, so my evenings and weekends will be a bit full to try making one up for testing...

  • Hi! having problem with aam program launch for downloading

    hi can you help me having problems downloading app I can't drag and drop and if I try to install using download link it tells me to choose the aam program I want to use.  I have successfully downloaded other apps before and dont know where to find this program really need some help with this. Thanks!

    Thanks
    for quick response
    I can access the aam now that I know what it stands for by opening the application seperately from the desktop and download. What I cant do is download from the cloud site where it is unable to locate and open the aam from there. As long as I can download I dont have a problem with it Im guessing it may well be a windows or browser issue. I will try from chrome if I it doesnt work I will let the firum know I would be interested to know whether its something Im doing or its a common issue.
    Cheers
    Helen

  • I'm having problems installing Photoshop Cs6 using the Akamai download manager.Is anyone else having an issue?

    Anyone also having problems?

    use a different browser or download directly,
    Downloads available:
    Suites and Programs:  CC 2014 | CC | CS6 | CS5.5 | CS5 | CS4 | CS3
    Acrobat:  XI, X | 9,8 | 9 standard
    Premiere Elements:  12 | 11, 10 | 9, 8, 7
    Photoshop Elements:  12 | 11, 10 | 9,8,7
    Lightroom:  5.5 (win), 5.5 (mac) | 5.4 (win), 5.4 (mac) | 5 | 4 | 3
    Captivate:  8 | 7 | 6 | 5
    Contribute:  CS5 | CS4, CS3
    Download and installation help for Adobe links
    Download and installation help for Prodesigntools links are listed on most linked pages.  They are critical; especially steps 1, 2 and 3.  If you click a link that does not have those steps listed, open a second window using the Lightroom 3 link to see those 'Important Instructions'.

Maybe you are looking for

  • Wi-Fi Sharing doesn't work together with mini Display port

    Hello everyone! I can tell you fantstic problem. Sorry for my English - i'm from Russia! The problem: 1. Share Wi-Fi via bonjour to other devices such as iPad, iPhone, windows computers, etc. I'm using Mac os X Snow Leopard! Everything is fine! 2. Ju

  • Fails to connect to the Oracle yum public server

    Hello, I would like to connect to the Oracle public yum server so I can install packages from the Oracle Linux via a yum client for my RHEL 5.4 I am trying to download and copy the appropriate yum configuration file in place, by running the following

  • JSF 2.0 FileUpload - form-data Issues

    Maestros, I am going to be a little lengthy here, but before I continue I would like to beg for your indulgence. I am currently working on a web application using a combination of JSF/Spring and have managed to get myself in a tight corner and need s

  • Import data form text files

    I wish to import multiple text files into one table in SQL Server 2008 but I don't have SSIS capability. I wish for the format of the file to stay the same (no formatting or modification of data) and I wish for each file to be dumped into its own row

  • Macbook Pro with retina display software question

    I am thinking of replacing my curren Macbook Pro that is 3 years old with the new Macbook pro with retina display; I need to know if Mac Office 2011 will run on this computer as well as iWorks 09. Thanks------Roger