• Post Reply Bookmark Topic Watch Topic
  • New Topic

Listing files embedded in an EAR  RSS feed

 
vince walker
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Sheriff
Posts: 22185
38
Eclipse IDE Firefox Browser MySQL Database
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Store a text file along with the XML files which contains a list of the names of the XML files.
 
Balaji Manoharan Bm
Greenhorn
Posts: 13
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Give the directory name as input to getResourceAsStream() and the use File.listFiles() method to know all the files available in that directory.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!