File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Beginning Java and the fly likes getresource path Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login

Win a copy of Java Interview Guide this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "getresource path" Watch "getresource path" New topic

getresource path

Jorge Sereno

Joined: Jun 30, 2012
Posts: 9
Where is the path the method

looks for.

Jorge Sereno

Joined: Jun 30, 2012
Posts: 9
how can i define the global path for the method looks for?

A structure like

when i use somewhere in the app looks for the path resources/file.txt.
Kemal Sokolovic

Joined: Jun 19, 2010
Posts: 825

First of all, I would suggest you read HowToAskQuestionsOnJavaRanch FAQ.

As for your problem, to access root directory (package) in src you add forward slash at the beginning of your String. Further it's the matter of your package structure:

Also note that Java is case sensitive so there are no methods getclass() or getresource().

The quieter you are, the more you are able to hear.
I agree. Here's the link:
subject: getresource path
It's not a secret anymore!