Having problem making my program play the sound i want it to play...
807600Sep 1 2007 — edited Sep 2 2007Ok, 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?