#Error while reading file from src-main-resources folder

21 messages · Page 1 of 1 (latest)

frozen fjordBOT
#

This post has been reserved for your question.

Hey @sacred stratus! Please use /close or the Close Post button above when you're finished. Please remember to follow the help guidelines. This post will be automatically closed after 300 minutes of inactivity.

TIP: Narrow down your issue to simple and precise questions to maximize the chance that others will reply in here.

sacred stratus
#

Hi friends,
I am trying to read a file from src/main/resources but it is giving me an error.
(Error: filenotfoundexception)
Attached the image of my code please help me to solve this.

long quartz
#

And no double slash

sacred stratus
# long quartz Try just /price.xlsx

Hi @long quartz it's done with input stream I have used getResourceStream method but there is one issue after taking this input I am writing that file using OutputStream but not able to give the absolute path of /src/main/resources to create new file in it

long quartz
#

e.g. a new xls?

sacred stratus
long quartz
#

what happens if you write it to /myfile.xlsx

#

(not sure this will worok)

sacred stratus
long quartz
#

click on src/main/resources and f5?

sacred stratus
long quartz
#

so i don't know if putting things into src/main/resources (i.e. the resource root at build time) will ever work

#

unless of course if you specify the absolute OS path to src/main/resources then it will work

frozen fjordBOT
#

💤 Post marked as dormant

This post has been inactive for over 300 minutes, thus, it has been archived.
If your question was not answered yet, feel free to re-open this post or create a new one.

sacred stratus