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 Java in General and the fly likes Problems with file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Java in General
Bookmark "Problems with file " Watch "Problems with file " New topic
Author

Problems with file

Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
Hi,

I have one java file in a package which has one properties file. Now I want to access this properties file through java file. I dont want to specify location of the properties file.
When I just pass name of properties file to File then its unable to find file.
Please help me in this problem.

Regards,
Anand


~ Anand,
SCJP 1.5, SCWCD 1.5
Ernest Friedman-Hill
author and iconoclast
Marshal

Joined: Jul 08, 2003
Posts: 24189
    
  34

You want to use one of the getResource() methods in Class or ClassLoader. From an instance method of a class, you can just say something like



[Jess in Action][AskingGoodQuestions]
Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150
thanks a lot
 
I’ve looked at a lot of different solutions, and in my humble opinion Aspose is the way to go. Here’s the link: http://aspose.com
 
subject: Problems with file
 
It's not a secret anymore!