Reputation: 1616
I cannot create a new File on Tomcat server here is a picture of the problem:
What am I doing wrong here? Reading is no Problem but overwriting the file is. Im confused why I cant get it to work! Also new File() is executed on Windows if you wonder.
Edit: I resolved it. I was accessing it in my Program Files folder. I moved the Tomcat folder to my Desktop and I can now write to it.
Upvotes: 0
Views: 1352
Reputation: 973
You are reading a file which lives in a WAR file. It depends on your tomcat configuration whether the WARs are expanded or not. This means for you: you can NOT rely on any of your web content to be writable. But you can copy this file to a work directory and start working on it there. As you might know, every servlet context gets its own dedicated temporary work directory:
servletContext.getAttribute(ServletContext.TEMPDIR);
It survives server restarts, but it can be purged if necessary. If you need something more permanent, you need to specify the location yourself.
Upvotes: 2