tomcat-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Brian Teutsch <b-teut...@northwestern.edu>
Subject file reading and writing
Date Wed, 04 Apr 2001 03:45:29 GMT
I am trying to control some file reading and writing. I'm trying to 
transition some servlets from QuidProQuo, and the primary difficult I am 
having is figuring out how to read and write a file. I've tried to debug 
everything I can think of, mostly the permissions on all the work 
directories (localhost_8080* all set to rwx). Getting accustomed to OS 
X, I know that permissions can be a big sticking point. Although it 
could be something else completely, despite the error.

Here's the code I am trying in a simple servlet.
--
DataOutputStream fileOut;
fileOut = new DataOutputStream( new FileOutputStream("output.txt"));
fileOut.writeBytes("test");
fileOut.close();
--
A call to 
getServletContext().getAttribute("javax.servlet.context.tempdir") 
returns:
jakarta-tomcat-3.2.1/work/localhost_8080

And the servlet catches the exception:
java.io.FileNotFoundException: output.txt (Permission denied)

So, where does the servlet store things it wants to access? I'm just 
looking for something simple here, until I have the time to learn jar 
file access in general. Hopefully I'm just missing something in the 
development or config docs.

Brian Teutsch

Mime
View raw message