• 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

Accessing resources outside of the Jar

 
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hello,

i package my stand alone application as a jar file. But while distributing it, i will provide some resource files outside of the jar file. (like index files directory for Lucene, some xml configuration files that can be changed runtime )
What is the way of accessing outside resources from a jar file? Lets say i have this structure

/myApp
/config
/indexes
/lib
/MyApp.jar
/Other jars that i use

inside the code, normally i access the resources with this.getClass.getResource(<relative path> ; or
this.getClass.getResource(<relative path> .getPath();

But when i pack it with jar, how will i lets say access to /config directory? when i stated the app from myApp/lib/MyApp.jar ? is there a resource finder, that i can use for accessing like "../config" within the code?
 
ahmet akin
Greenhorn
Posts: 14
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Sorry i needed to format the directory structure:

 
reply
    Bookmark Topic Watch Topic
  • New Topic