Access files (.wav) in java package

Posted by Highmastdon on Stack Overflow See other posts from Stack Overflow or by Highmastdon
Published on 2012-11-12T10:29:46Z Indexed on 2012/11/12 11:00 UTC
Read the original article Hit count: 219

I want to access my .wav files which are in a package inside my project.

For example I got two packages: package program package sounds

From inside the program/something.class I'd like to play the sounds/asound.wav. How is this possible.

clip.open(AudioSystem.getAudioInputStream(new File(filename)));
clip.start();
//.... something inbetween
clip.stop();

Here filename is C:\\projects\\something\\sounds\\, but how is it possible to just give a relative path to the asound.wav in the package?

© Stack Overflow or respective owner

Related posts about java

Related posts about audio