Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / August 2006

Tip: Looking for answers? Try searching our database.

File Can Not be Found

Thread view: 
RigasMinho - 31 Aug 2006 15:55 GMT
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"));
   
       
    }
Chris Smith - 31 Aug 2006 16:17 GMT
> 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.

Signature

Chris Smith



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.