• 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

How to access non class files in a JAR

 
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi All

I have a situation, i am trying to create a JAR, with class files and XML files in it, which my other modules will be using (These are Junit test classes which will be using this). I have the classpath set in my ANT target, so i am able to access the class files, but it fails to read the XML file, i was of the impression we can have any file in the JAR file, can any one please share their experience in this regard.

Thanks in advance
Hari
 
author and iconoclast
Posts: 24207
46
Mac OS X Eclipse IDE Chrome
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
You can, but you have to work with the correctly. You can open them using the Class.getResource() method (and related methods.)
 
Haricharan Ramachandra
Greenhorn
Posts: 28
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for such a fast responce Ernest, really appriciate it. I guess my co-developers might not be nerv happy to make changes in their code,But i got a point to put across, thanks to you . so probably i will leave out the XML files from JAR for now.

regards
Hari
reply
    Bookmark Topic Watch Topic
  • New Topic