× 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.



This message is in MIME format. Since your mail reader does not understand
this format, some or all of this message may not be legible.
--
[ Picked text/plain from multipart/alternative ]
Joe,

Thanks for your help. I haven't yet got as far as putting the code on the
400, so I'm just trying to get it to run in the WTE (hence no tabs!) This
seems to use a naff folder for it's document root - VisualAge for
Java/ide/tools/com-ibm-ivj-ui-webcontrolcenter. Is there any way to change
this?

Not sure where I got the idea new FileInputStream would create the file
from....anyway my code saves the properties object later on, so I have got a
file created.

I can get round my problem by using the file system root for now
(\\mydir\my.properties instead of mydir\my.properties) This might cause
problems when I distribute the software to the 400 thou...

Chris

 -----Original Message-----
From:   Joe Pluta [mailto:joepluta@PlutaBrothers.com]
Sent:   02 January 2002 14:23
To:     java400-l@midrange.com
Subject:        RE: Servlet Properties

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?

_______________________________________________
This is the Java Programming on and around the iSeries / AS400 (JAVA400-L)
mailing list
To post a message email: JAVA400-L@midrange.com
To subscribe, unsubscribe, or change list options,
visit: http://lists.midrange.com/cgi-bin/listinfo/java400-l
or email: JAVA400-L-request@midrange.com
Before posting, please take a moment to review the archives
at http://archive.midrange.com/java400-l.


As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:

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.