Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

FileInputStream error

 
sachin y deshpande
Greenhorn
Posts: 20
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
We are trying to read a properties file using FileInputStream in our j2ee app:


The properties file is in a jar defined as a utility jar within the server and associated with the app.

We are getting the following error





Funnily we get the file if we use Resource bundle to load the file.

Please help.
 
Steve Luke
Bartender
Posts: 4181
21
IntelliJ IDE Java Python
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The FileInputStream will be looking for the file as a Real File, in the JVM's active directory (wherever that happens to be). It does not look through the classpath, and I don't think it will open a file from a JAR file either.

The resource bundle is the proper route to go here.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic