aspose file tools*
The moose likes Tomcat and the fly likes Tomcat Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Tomcat "working directory"" Watch "Tomcat "working directory"" New topic
Author

Tomcat "working directory"

adrian calvin
Greenhorn

Joined: Apr 07, 2005
Posts: 1
Hello,

1) I have struggled with this for days. I DAFS many many times and still have not gotten it worked out. I need to know how to change the working directory Tomcat uses. This is important to me, since I would like to use _relative paths_ when accessing local resources on the server, like text files. What really makes this a problem is I have potentially 50 servers I will need to deploy to, and so far, although my apps work fine in my development environment( Netbeans ) they are not working when I deploy. And if I mak changes like using absolute paths, or 'getRealPath' method, they work remotely but not in my development environment. This is my main issue.

2) On a side note, I notice when developing web apps in Netbeans, Netbeans puts an absolute path for the _docBase_ in the _context.xml_ file. This is very annoying because I have to edit the file manually _OUTSIDE_ of Netbeans before I deploy the app to a another server. If anyone can help with these 2 questions I would be very happy. Thank you.



Adrian
William Brogden
Author and all-around good cowpoke
Rancher

Joined: Mar 22, 2000
Posts: 12788
    
    5
You can not use ANY file operations that depend on the operating system "working directory." For one thing, it would conflict with other web applications.
The Servlet API provides for relative directory structure based on the location of your "web application" - this way it is completely universal and portable between servers. See the JavaDocs for ServletContext.
I can't imagine why the getRealPath method fails to work correctly in NetBeans.
If you absolutely can't use getRealPath, try configuring directories in init-parms in web.xml.
Bill
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Tomcat "working directory"