File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
Win a copy of Clojure in Action this week in the Clojure forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How to access non class files in a JAR

 
Haricharan Ramachandra
Greenhorn
Posts: 28
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
Ernest Friedman-Hill
author and iconoclast
Marshal
Pie
Posts: 24204
34
Chrome Eclipse IDE Mac OS X
  • 0
  • Mark post as helpful
  • send pies
  • 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
  • 0
  • Mark post as helpful
  • send pies
  • 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
 
I agree. Here's the link: http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic