Where to write files form a web application running on Tomcat on Ubuntu?
12,287
I found the solution on Launchpad. /var/lib/tomcat6/webapps/
is writable. This means, that the following works:
File myFile = new File("webapps/myfile.txt");
Related videos on Youtube
Author by
Witek
Updated on September 17, 2022Comments
-
Witek over 1 year
I have a Java web application (
myapp.war
) which I want do deploy to Tomcat, which is provided by Ubuntu (packagetomcat6
). This works by placingmyapp.jar
to thewebapps
direcotry. This works.Now, my application has to store some data to local files. My idea was to write to the users home direcotry or to the current work direcotry. But on Ubuntu 10.04 the user is
tomcat6
, its home is/usr/lib/tomcat6/
and the current work directory is/var/lib/tomcat6/
. And both belong toroot
. Therefore writing is impossible.So where should a web application store its files?
-
David J. Liszewski almost 14 yearsAlso asked and answered on SO stackoverflow.com/questions/3160343/…
-