I am using Intellij IDEA. For some reason the "Manage Attachments" button here doesn't do anything when clicked, so I've put an image showing the project tree up on imgur:
https://imgur.com/a/jq8LeFO
I am trying to access the file data.xlsx in /res/data/. It appears I have set up the resources folder correctly since it created the matching output folders and copied the files there.
One of my files contains the line:
dataFile = new XSSFWorkbook(getClass().getResource("/data/data.xlsx").toString());
This results in an error:
Caused by: java.io.FileNotFoundException: file:\C:\Users\t74bd\IdeaProjects\Phobos%20Project \out\production\Phobos%20Project\data\data.xlsx (The filename, directory name, or volume label syntax is incorrect)
However when I specify the direct path:
This works without error.dataFile = new XSSFWorkbook("c:/Users/t74bd/IdeaProjects/Phobos Project/out/production/Phobos Project/data/data.xlsx");
I did notice that the error the first time included "file:\" before "C", so I tried this:
This still gives the error:dataFile = new XSSFWorkbook(getClass().getResource("/data/data.xlsx").toString().substring(6));
Caused by: java.io.FileNotFoundException: C:\Users\t74bd\IdeaProjects\Phobos%20Project\out\p roduction\Phobos%20Project\data\data.xlsx (The system cannot find the path specified)
I also noticed that it has swapped backslashes with forward slashes, and is using an escape sequence %20. I'm assuming these aren't issues.
EDIT: The last error message posted above appears to have a space in the word "production". That space only shows in the post, not when I edit the post (as I am now). It's not there, just some weird forum bug inserting a space.