0

I want to create a jar with wav files on it so I can play them as resources.

While running Eclipse, I first declare the folder locally like this:

File folderStimuli= new File("C:\\Users\\Martin\\Stimulus");

    public void play(File file) throws UnsupportedAudioFileException, IOException, LineUnavailableException{


    if (status != PLAYING) {
        clip = AudioSystem.getClip();
        AudioInputStream ais = AudioSystem.getAudioInputStream(file);
        clip.open(ais);
        clip.addLineListener(this.lineListener);
        status = PLAYING;
        this.timeStart=System.currentTimeMillis();
        clip.start();
    }
}

I now have my files on the project folder, namely, /src/main/resources and want to create a jar that reads the files from there. As a beginner, I don't have a clue how to do it. Would you please be so kind indicating what do I have to change here in order to work?

thank you really much!

Martin

Mart R
  • 126
  • 11
  • possible duplicate of [play .wav file from jar as resource using java](http://stackoverflow.com/questions/8425481/play-wav-file-from-jar-as-resource-using-java) – dbillz Jul 10 '15 at 13:58
  • not quite a duplicate... here I want to refer to a whole folder as resource instead of a single file – Mart R Jul 11 '15 at 10:11

0 Answers0