The following code works:
FileWriter fwrite;
try
{
fwrite = new FileWriter("/usr/local/webserver/tomcat/webapps/myWebapp/conf/" + project + ".conf");
// ...etc.
}
catch(IOException e)
{
// ... etc.
}
But if I change the path in fwrite = new FileWriter() to ../../../../conf/ (making it relative to the class file) or to /myWebapp/conf/ (relative to tomcat's servlets root; with or without the leading /) or to conf/ (relative to the myWebapp directory, which is the docBase declared in the context element in server.xml), I get a FileNotFound (No such file or directory) exception.
How do I make the path relative to the servlet, so I don't have to hard code the path?
The app won't be deployed on a public web server, so writing a file to the server is not a problem, though I would like to have some flexibility about where things get deployed---may end up on a Windows machine, may stay on the Linux box. But I want to make that decision external to the code.
Thanks.
Jerry
--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]
