问题
I'm writing a service for Axis2 + Tomcat7.0 with Java for the application. I've chosen to write any information to xml file, the problem is where is the root of the service/application server?
I read the other question but isn't response good.
How can I get an absolute path to the writable directory by the service?
回答1:
I would set an environment variable and then read the value of it by using System.getProperty().
I think the default file writing location is wherever you are when you start the server, at least that's what I found with JBoss one time. The easiest thing is to either set an environment variable in a server property file, or create a property file for your service to use to retrieve the location. I've done it both ways with JBoss in windows and unix.
来源:https://stackoverflow.com/questions/8918329/write-and-read-file-on-web-service-axis2-tomcat-7