I am working on a game in java and I have a class that reads an audio file as InputStream and then plays that file through AudioPlayer. I keep getting a file not found exception. I have tried placing the audio files in many different locations, and nothing has worked.
public void play(String string,int sleep) throws IOException
{
//this part does not recognize file
try {
//System.out.println(System.getProperty());
AS = new AudioStream(new FileInputStream(string));
AD = AS.getData();
loop = new ContinuousAudioDataStream(AD);
}catch(IOException error){
System.out.print(string +" file not found");
}
AP.start(loop);
}
0 Answer(s)