intellij idea - Can't access a folder in java package -


i want read of files within package without using entire file path. example can use of files in dir.

new file("/users/me/documents/workspace/testing/src/main/java/resources/").listfiles() 

when have package in intellij looks this:

main - java --com.testfile --resources 

i read this: read file folder inside project directory. want able without specifying the whole path.

for example explained here: how read file (e.g txt file) java package withouth specifying absolute path?

i thought like

"src/main/java/resources" every combination try fails when plugged in to:

new file("/users/me/documents/workspace/testing/src/main/java/resources/").listfiles() 

i have sworn i've done before this? making silly mistake?

as of right can't locate file. it's being run file in file in java -> com.thisproject/app

for example i'm seeing:

file folder = new file("src/"); file[] listoffiles = folder.listfiles(); 

have listoffiles null.

solved... kind of weird. found online said reference src/main etc... file path.

however able access through:

new file("java/resources").listfiles();  

which works perfectly. if try of below combinations:

new file("/java/resources").listfiles();  new file("main/java/resources").listfiles();  new file("src/main/java/resources").listfiles();  

they fail.

for system info i'm using intellij, mac os, i'm working on intellij created webapp. not sure if makes difference.

if knows why src/... doesn't work i'd love know.


Comments