File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Tomcat and the fly likes Changing tomcat default working directory Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Products » Tomcat
Bookmark "Changing tomcat default working directory" Watch "Changing tomcat default working directory" New topic
Author

Changing tomcat default working directory

Vishal Sinha
Greenhorn

Joined: Jul 17, 2008
Posts: 6
Hello,
In my web application when I do (new File(".").getAbsolutePath()) the path returned is <tomcat_home>/bin directory. I want to change it to <tomcat_home>/webapps/<app_name> directory. Basically, I want to change the default directory for my web application to app directory.

Please let me know how to do it.
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

Web applications have no concept of a "current directory". You'll need to find another way to accomplish what you are trying to do, whatever that is.


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
Vishal Sinha
Greenhorn

Joined: Jul 17, 2008
Posts: 6
Can someone let me know how to accomplish it. I want the webapp root directory in my application. How can I do it?
Java helper
Greenhorn

Joined: Dec 22, 2008
Posts: 1
This problem comes when we using linux platform.
But in windows operating system you will get right path
%tomcat_home%/webapps/application


<a href="http://www.easywayserver.com/jsp/JSP-Tutorial.htm" target="_blank" rel="nofollow">JSP Tutorial</a> | <a href="http://www.easywayserver.com/jdbc/JDBC-tutorial.htm" target="_blank" rel="nofollow">JDBC Tutorial</a>
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61106
    
  66

"Java helper", please check your private messages for an important administrative matter.

And please do not dredge up older posts. Please read this for more information.
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Changing tomcat default working directory