GeeCON Prague 2014*
The moose likes Servlets and the fly likes finding a common file with System.getProperty? Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Servlets
Bookmark "finding a common file with System.getProperty?" Watch "finding a common file with System.getProperty?" New topic
Author

finding a common file with System.getProperty?

Yoo-Jin Lee
Ranch Hand

Joined: Nov 01, 2000
Posts: 119
Hi,
I'm trying to access the contents of the same file from a class that is invoked from a servlet and also an object invoked from the command line, in Windows NT. I don't want to hardcode the path either.
My code:
File currentDir = new File(System.getProperty("user.dir"));
File f = new File(currentDir,"tist.ini");
My problem is that from the servlet, the classpath to the file is c:\Winnt\system32 and from the dos command line it is the current directory. I tried to include the file to the current classpath but no dice.
(ie. classpath=..(previous stuff)..;c:\temp\tist.ini)
I guess I can create a small program that could search the whole directory tree but is there a better solution?
Thanks.
Yoo-Jin.
 
Don't get me started about those stupid light bulbs.
 
subject: finding a common file with System.getProperty?