#Easiest fix, unsure why FileIO is not properly working.
1 messages · Page 1 of 1 (latest)
⌛ This post has been reserved for your question.
Hey @lethal fulcrum! Please use
/closeor theClose Postbutton 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.
Show me the code
For files within your jar, you’re gonna wanna use Class#getResource/Class#getResourceAsStream rather than using file io
could you also share your folder structure of the project
try /inFile.txt
does the absolute path match for any of the two versions match the expected path ?
to phrase it differently is the absolute path of the file matching the absolute path of the file when checking in the explorer ?
Also double check that you've actually set up that file to be included when your project is built.
You can quickly check this by just unzipping the compiled jar and seeing if it's even in there.
That looks like it would be a .war, not a .jar.
A nonstandalone web app that needs to be run in a container
The container isn't going to use the project's "src" dir as working directory
Nor is it going to inspect it as a source for resource files
If that file is supposed to be part of that application, then it should be a resource of it. As this is not a Maven layout, the simpler to achieve that is to put that file alongside the .java files
Then, it cannot be read with filesystem IO, because in the end it's supposed to be part of a .war archive, not a file on the filesystem. So it will need to be read with getResourceAsStream()
💤 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.