Join the social network of Tech Nerds, increase skill rank, get work, manage projects...
 
  • Where to Place Audio Files to Get Rid of Not Found Exception Error in JAVA Program?

    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 0
    • 443
    Answer it

     

    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);     
    
    }

     

    I pass a string like ("audio/beginning.wav")

 0 Answer(s)

Sign In
                           OR                           
                           OR                           
Register

Sign up using

                           OR                           
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password: