• Post Reply Bookmark Topic Watch Topic
  • New Topic

finding a common file with System.getProperty?  RSS feed

Ranch Hand
Posts: 119
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!