File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
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
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
Error while defining class due to PARENT_FIRST class loader
Node Federation error
a servlet inside jar can not be accessed on web sphere at workplace
bad major version at offset=6
My Webspere contains so many errors how to resolve it