aspose file tools
The moose likes Servlets and the fly likes File location problem Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login
JavaRanch » Java Forums » Java » Servlets
Reply Bookmark "File location problem" Watch "File location problem" New topic
Author

File location problem

Neo Wills
Ranch Hand

Joined: Nov 29, 2006
Posts: 40
Hi,
I am using a Tomcat4.1...This is the problem that I am facing:

I have a exe which is to be run by the servlet.The exe uses the files in the current directory and generates files in the current directory. But I have no idea which is the current directory from which the servlet is executed.
I tried placing them in the WEB-INF\Classes....But I guess thats not the current dir from which the servlet runs...

Can some one help me out with this..

Thanks,
Bharath
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 56172
    
  13

There is no concept of a current diretory in web apps.

Search this forum for uses of the methods getRealPath and getResourceAsStream methods. One of these should be able to help you out.


[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 16482
    
    2

If you are using the Runtime.exec() method to execute this program then you could use the version that allows you to specify its current working directory.
 
I agree. Here's the link: jrebel
 
subject: File location problem
 
Similar Threads
Diff between execution from IDE and double clicking on the exe file?
Tomcat access/security problem
problem in running exec() from servlet
compiling command: servlet-api.jar:classes: . ?
Problem in running XSLT program