My project can't find my files
Answered
I have a project with some friends at university. We're making a program, where we can read a text file for movies and add them to a GUI. We've written "text/films.txt" and it works fine for both of my friends.
For me though, it doesn't. If I instead write the exact file path then I can find films.txt and the program works fine but that's of course not a solution. Can anyone help me so I can write "text/films.txt"?
Thanks in advance!
Victor Lotz
Please sign in to leave a comment.
Check that you properly marked the directory where your resources are located as a resource root. And check that after the build this file was copied into the expected location in the module's compile output directory.
We've fixed the problem. If anyone else has the same problem, here's how we fixed it:
Path current = Paths.get("../images");String s = current.toAbsolutePath().toString();
By writing these two lines above and using our variable 's', we could easily find folders from our project folder.