× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



I don't think will create the file, Chris.  That seems a little much to ask
for the FileInputStream class.  According to the JavaDoc:

"If the named file does not exist, is a directory rather than a regular
file, or for some other reason cannot be opened for reading then a
FileNotFoundException is thrown."

So, let's try to manually create the file.  If you'e using WAS3.0 or above,
look in your Web Application definition (in adminclient, Web Application is
under Servlet Engine, which is under Application Server, which is under
Node).  On the Advanced tab, the first field is Document Root.  Use that,
append "/mydir", and put "my.properties" into the resulting directory.

Joe


> From: Price, Chris
>
> File propPath = new File("mydir\\my.properties");
> myProperties = new Properties();
>
> //Load Properties from File
> try {
>       in = new FileInputStream(propPath);
>       myProperties.load(in);
>       in.close();
> } catch (IOException e) {
> }
>
> If I run this code in a "normal" java class, (i.e. with a main method), a
> properties file my.properties  is created, if one does not
> already exist, in
> the specified directory. If I put the code in the servlet, I get
> a file not
> found exception.
>
> How can I avoid the exception (why can't the servlet create the file?).
> Alternatively, where should I create the file manually, so the servlet
> engine finds it?



As an Amazon Associate we earn from qualifying purchases.

This thread ...

Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.