Win a copy of Murach's Python Programming this week in the Jython/Python forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

How to get inside a .ear file  RSS feed

 
Mahesh Bhatt
Ranch Hand
Posts: 88
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,

I have a java code, at a particular point in this class, I was reading a file. I used to give the path as C:\temp\subTemp\myfile.xml.

Now i have to access a file from inside an .ear file, how do I go about giving the path?
How to get inside the .ear file. What path do I use.
NOTE: I have to place the class file outside the .ear file

Regards,
Prashant
 
Ilja Preuss
author
Sheriff
Posts: 14112
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Remember that an ear file basically is a jar file with some special content. So you can use a jar-URL to reference files inside it:

jar:file athToEar/myEar.ear!/pathInsideEar/myfile.xml
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!