Hello Mina,
            It seems that you are trying to open up a remote file using
java.io.File, which is not allowed. To achieve this, you can choose any of
the following methods
1- Try to use relative or absolute path instead of URL.
2- Use JNDI to map the file system.
3- Use third party API like Weblogic T3Client.
hope it'll help,

Regards,
Rashid.
-------------------------------------------------------------------
Rashid Mohiuddin
Java Consultant
Fujitsu Singapore Ltd.
Tel: 65-7715829
[EMAIL PROTECTED]
http://stop.at/rashidm

----- Original Message -----
From: [Mina Gohari] <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Monday, January 17, 2000 1:46 PM
Subject: Re: Read a TXT file


     Thanks for your help , but my question is about the path of file , I
     put the file (Head.txt) in path of Servlets such as
     (\\localhost\ApacheGroup\Jserv\servlets) then I refer to that in my
     program with this path (http://localhost:8000/servlet/Head.txt) or
     (http://localhost/servlet/Head.txt) but it returns

     java.io.FileNotFoundException: http:\localhost:8000\servlet\Head.txt
     (The filename, directory name, or volume label syntax is incorrect)

     Please tell me about setting the path of file that I want to read from
     that.

     Mina




______________________________ Reply Separator
_________________________________
Subject: Re: Read a TXT file
Author:  <[EMAIL PROTECTED]> at internet
Date:    16/01/2000 09:06 �


Hey!

Woah!  Mina you want to send a file back to your browser.  Well a couple
of items are necessary.

Your servlet container must support this with a file servlet.
You need to roll your own software to stream back the file
data.

A good example on how to do this is included in Jason Hunter's book.
You can check this E-list's archive for details on how to buy his book
and get use of his software.

BTW, you can send more than just text files.  Spread sheets, word docs,
images
etc.  Your browser need to be able to launch applications though.  Netscape
works and don't use IE so I can't say.

Sans adieu,
Danny Rubis

"[Mina Gohari]" wrote:

>      Hi to all professional
>
>      I use from Apache and NT as server , I wrote a servlet that this
>      servlet read from a txt file , It said that FileNotFoundException ,
>      Why? please answer me.
>
>      Thanks in advance.
>
>      try {
>            File inputFile = new File("http://localhost:8000/Head.txt");
>            in = new FileReader(inputFile);
>            while ((c = in.read()) != -1)
>              HTMLBuffer.append((char) c);
>            in.close();
>          }
>      catch (IOException ioe) {
>            HTMLBuffer.append(ioe.toString());
>          }
>
>      Mina
>
>
___________________________________________________________________________
> To unsubscribe, send email to [EMAIL PROTECTED] and include in the
body
> of the message "signoff SERVLET-INTEREST".
>
> Archives: http://archives.java.sun.com/archives/servlet-interest.html
> Resources: http://java.sun.com/products/servlet/external-resources.html
> LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".

Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html

Reply via email to