File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes EJB and other Java EE Technologies and the fly likes Listing files embedded in an EAR Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » EJB and other Java EE Technologies
Bookmark "Listing files embedded in an EAR" Watch "Listing files embedded in an EAR" New topic
Author

Listing files embedded in an EAR

vince walker
Greenhorn

Joined: Aug 30, 2013
Posts: 1
I have XML files which I want to store in an EAR. When the app starts, I want to read all the XML files and load them into memory. I found getClass().getResourceAsStream(...) to load a file if I know the name. But how can I list all the files and iterate through them if I don't know the names in advance?
Paul Clapham
Bartender

Joined: Oct 14, 2005
Posts: 18991
    
    8

Store a text file along with the XML files which contains a list of the names of the XML files.
Balaji Manoharan Bm
Greenhorn

Joined: Sep 22, 2013
Posts: 13
Give the directory name as input to getResourceAsStream() and the use File.listFiles() method to know all the files available in that directory.
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Listing files embedded in an EAR