File Can Not be Found

R

RigasMinho

I have this source code here where it cant find the file:
Staging_PasswordAdministration.properties.
No clue why it gives me this error because the file is named correctly
and is in the same working directory as the jsp file.

Basically all i want to do is load a properties file that i have.
Wondering if java.io.FileInputStream is even the right function to do
this.

let me know


Properties prop = System.getProperties();
osname = prop.getProperty("os.name");
if (osname.equals("Windows XP"))
{
test = ("same words");

prop.load(new
java.io.FileInputStream"Staging_PasswordAdministration.properties"));


}
 
C

Chris Smith

RigasMinho said:
I have this source code here where it cant find the file:
Staging_PasswordAdministration.properties.
No clue why it gives me this error because the file is named correctly
and is in the same working directory as the jsp file.

Use ServletContext.getResourceAsStream. FileInputStream looks for files
relative to the current working directory, *not* the directory
containing the JSP. The current working directory is undefined in a web
application environment.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,982
Messages
2,570,185
Members
46,736
Latest member
AdolphBig6

Latest Threads

Top