File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Problems with file

Anand Loni
Ranch Hand

Joined: Jan 20, 2006
Posts: 150

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.


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

Joined: Jul 08, 2003
Posts: 24199

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 agree. Here's the link:
subject: Problems with file
It's not a secret anymore!