Win a copy of Re-engineering Legacy Software this week in the Refactoring forum
or Docker in Action in the Cloud/Virtualization forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

getresource path

 
Jorge Sereno
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi
Where is the path the method

looks for.

Thankx
 
Jorge Sereno
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Specifying,
how can i define the global path for the method looks for?

Example.
A structure like
src
--pt.ts1
----Main.java
--pt.ts2
----MainTest.java
resources
--file.txt

when i use somewhere in the app looks for the path resources/file.txt.
 
Kemal Sokolovic
Bartender
Posts: 825
5
Java Python Ruby
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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().
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic