0

I can't use these files in my resource folder, what is wrong with my code?

The files are in a resources folder which is a subfolder of "src"

I tried absolute and a relative path. Nothing works anymore.

Desktop.getDesktop().open(new File("resources/testfile.png"));

This is how my files are stored in my project

Willey3x37
  • 310
  • 2
  • 12
  • Just to clarify, you do not expect the resources folder to somehow be packaged into the jar that gets built when compiling your project? There are posts on that, like this one, https://stackoverflow.com/questions/7263505/how-to-package-resources-in-jar-properly. I'm shocked loading that png via correct absolute path does not work. You show a relative path in your example. If that's the case, it looks like you need to be running your program from the src directory based on that screenshot. Is that what you're doing? If so, I suspect you have a file permissions issue. – Evan Mar 25 '19 at 20:01
  • Is this problem in IDE or only when you packaged it as a jar file? – Willey3x37 Jun 30 '19 at 19:03

0 Answers0