Without specifying a path, the server will use its default path to look for
your file. For example, with Tomcat, it is the server bin directory. So, it
will look in $TPMCAT_HOME/bin. Try to use something like. If MyFile is in
the server's document root try to use something like :
String path = getServletConfig().getServletContext().getRealPath("/");
FileInputStream solkey = new FileInputStream(path + "MyFile");
Pierre-Yves
-----Message d'origine-----
De : A mailing list for discussion about Sun Microsystem's Java Servlet
API Technology. [mailto:[EMAIL PROTECTED]]De la part de Sol
Christopher Gipulan
Envoyé : lundi 26 mars 2001 09:08
À : [EMAIL PROTECTED]
Objet : Newbie...FileNotFoundException in servlet
Importance : Haute
Hi to all.
Before, accessing file in my JAVA program works but when I put the codes in
a servlet a FileNotFoundException prompts me. I'm using JSDK 2.1 in testing
the servlet.
Here's the code:
byte[] MyKey = null;
try{
FileInputStream solkey = new
FileInputStream("MyFile");
MyKey = new byte[solkey.available()];
Because I'm new in the technology, can anyone suggest any tool in developing
servlets (right now I'm just using notepad as my editor.)
Any suggestions/comments are welcome. Thank you in advance for your help.
Good day.
___________________________________________________________________________
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