This week's book giveaway is in the OO, Patterns, UML and Refactoring forum.
We're giving away four copies of Refactoring for Software Design Smells: Managing Technical Debt and have Girish Suryanarayana, Ganesh Samarthyam & Tushar Sharma on-line!
See this thread for details.
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

finding a common file with System.getProperty?

Yoo-Jin Lee
Ranch Hand

Joined: Nov 01, 2000
Posts: 119
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?
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link:
subject: finding a common file with System.getProperty?
jQuery in Action, 3rd edition