This week's giveaway is in the Android forum.
We're giving away four copies of Android Security Essentials Live Lessons and have Godfrey Nolan on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Finding path location on server returning null Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Finding path location on server returning null" Watch "Finding path location on server returning null" New topic
Author

Finding path location on server returning null

Martin Russell Thorpe
Greenhorn

Joined: Jun 11, 2009
Posts: 3
Hello.

I am running a class on an application server and trying to find a relative path so I can load a file from within my Java class.

I have been investigating using this.getClass().getResource("../") and get the location of the running class, which is good, but when I try to navigate up the tree I can get so far and then I get null.

For example



Note that testF jumps from the classes dir to properties for some reason and then testG returns null.
What I want to do is get to myappwar directory. note this is not a servlet

Is this the correct approach or should I use some other way?

Thanks for reading
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Finding path location on server returning null
 
Similar Threads
My Webspere contains so many errors how to resolve it
bad major version at offset=6
a servlet inside jar can not be accessed on web sphere at workplace
Node Federation error
Error while defining class due to PARENT_FIRST class loader