noobie45 wrote:
I have an application whose class files are in
/usr/local/tomcat/webapps/ROOT/WEB-INF/classes

It uses the following line to write a file called java.php:
FileOutputStream fout  = new FileOutputStream
("/usr/local/tomcat/webapps/ROOT/java.php", true);

It does this perfectly.

What I want is to write this file to a directory outside the tomcat
directory. e.g. to /var/www/newdir

In Tomcat under Windows I have no problem doing this. Tomcat is installed in
F: and I can write to my apache directory c:\Apache2\htdocs by putting this
file path in the above code line.

But Tomcat under Linux does not allow me to do this, apparently for security
reasons. But security does not really matter for me because this application
won't be open. How do I read and write files outside the home directory?

Maybe just verify that the user-id under which Tomcat runs has the permission to write to the directory where you tell it to write ?

Under Windows, you do not see that problem because you are probably running the Tomcat service under the user-id "LocalSystem", which has extensive access rights to all local resources. But under Unix/Linux, Tomcat will be running as some user (tomcat5 ?), which does not by default have writing rights to /var/www, or wherever your webserver directory is. It is not a Tomcat-level permission issue, it is a OS-level permission issue.


---------------------------------------------------------------------
To unsubscribe, e-mail: users-unsubscr...@tomcat.apache.org
For additional commands, e-mail: users-h...@tomcat.apache.org

Reply via email to