• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Finding path location on server returning null

 
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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
 
reply
    Bookmark Topic Watch Topic
  • New Topic