This is a section of code from a processing program( I’ve stripped it down to the problem area). What am I doing Wrong that Im not able to print out a list of files using java.io
import java.io.*
setup() {
File musicDir = new File("data/music");
File[] listOfFiles = musicDir.listFiles();
println(listOfFiles[0]);
}
The files inside of data/music are four mp3 files. I’ve also tried this with the absolute path of the music directory.
I expect it to output something like: “song.mp3”
instead I get “Null Pointer Execption”, and the println line gets highlighted in the ide
Gavin Champ is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.