This week's book giveaway is in the Jobs Discussion forum.
We're giving away four copies of Soft Skills and have John Sonmez on-line!
See this thread for details.
The moose likes Java in General and the fly likes How to get inside a .ear file Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Java in General
Bookmark "How to get inside a .ear file" Watch "How to get inside a .ear file" New topic
Author

How to get inside a .ear file

Mahesh Bhatt
Ranch Hand

Joined: Sep 15, 2004
Posts: 88
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


Impossible is I M Possible
Ilja Preuss
author
Sheriff

Joined: Jul 11, 2001
Posts: 14112
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


The soul is dyed the color of its thoughts. Think only on those things that are in line with your principles and can bear the light of day. The content of your character is your choice. Day by day, what you do is who you become. Your integrity is your destiny - it is the light that guides your way. - Heraclitus
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to get inside a .ear file