File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes FileInputStream error Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "FileInputStream error" Watch "FileInputStream error" New topic

FileInputStream error

sachin y deshpande

Joined: May 12, 2004
Posts: 20
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

Joined: Jan 28, 2003
Posts: 4181

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.

I agree. Here's the link:
subject: FileInputStream error
It's not a secret anymore!