I'm trying to play a music file in Eclipse using Minim. But I'm getting this error:
==== JavaSound Minim Error ====
==== java.io.FileNotFoundException: groove.mp3
=== Minim Error ===
=== Couldn't load the file groove.mp3
In the Processing editor the file has to be in the data
folder of the sketch, but where should I put my file when I'm using Eclipse?
My code:
import ddf.minim.AudioPlayer;
import ddf.minim.Minim;
import processing.core.PApplet;
public class test extends PApplet {
Minim minim;
AudioPlayer player;
public static void main(String[] args) {
PApplet.main(test.class);
}
@Override
public void settings() {
size(600, 600);
}
@Override
public void setup() {
background(255);
minim = new Minim(this);
player = minim.loadFile("groove.mp3");
//player.play();
}
@Override
public void draw() {
}
}
I don't know where to put it off the top of my head, but here's what I'd do to figure it out:
Try printing this out:
System.out.println(new File().getAbsolutePath());
This will tell you which directory you're running from.
Generally, I would guess that files would go in the top level of your project, next to the src
directory. You could also try adding a data
directory there and putting your file in there.