I've come across a problem in trying to load files.
I'm pretty practiced with loading files in Java using java.IO.File
but I'm having trouble when importing some of my older code to Processing.
everything is working just fine for the most part.
I've got some conceptions about processing that I would like elaborated on, but that is for another question.
What I'm currently trying to do involves using Scanner to read from a new File as so:
// irrelevant declaration/imports not shown
public void load(String filename){
world = new byte[num][num];
try{
Scanner read = new Scanner(new File(filename+".txt");
}
catch(IOException e){
System.out.println(e.getMessage());
}
}
I have inserted a file into the project though [ Sketch > Add File.. ], and it has showed up in a 'data' folder,
but my program still spits back the exception: " example.txt (The system cannot find the file specified) "
I have double checked filenames and have tried putting the file directly into the root directory as well.
So far I have crawled Google, but I can't seem to find someone else with this problem.
From what I understand, Processing is fundamentally Java, which leads me to believe that there is something being done differently with the way folder structure is generated.
Where do I need to put this text file?
Do I need to unpack that .pde somehow?
I'd really like to avoid loadStrings()
if possible.
Something about parsing leaves a bad taste in my mouth which is why Scanner.nextInt() is so nice.