11

How would I do something like this in intelliJ IDEA

File file = new File("C:\Users\Account\Documents\ProjectFolder\ResourceFolder\image");

But not have to enter the whole file path in. I'm pretty sure there is a way, and I'm fairly certain it has something to do with adding it to my build path. I know how to do that in Eclipse but not in intelliJ.
Thanks in advance!

Hobbs2000
  • 311
  • 1
  • 6
  • 19

1 Answers1

8

You should use Java resource loading system. This is not depending on your IDE. Once you have marked a folder as resource folder in IntelliJ, it is available in your code as via resource loader.

Community
  • 1
  • 1
uwolfer
  • 4,356
  • 1
  • 25
  • 40
  • Thanks for the help! I did end up using the resource loader, but I had to convert the java.net.URL it returned into a URI because the URL contained characters such as "%20". And those characters could not be used in the path for a new File. The new URI simply converted those characters into what they really mean, "%20" for instance is actually a space. – Hobbs2000 Oct 24 '15 at 17:36