Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

how to get files with a specific path for a jar file

 
Howie Jiang
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi,

I want to process a jar file in a java program.

I use JarFile jf = new JarFile("abc.jar");

Then in order to find all the files with path "com/def/". How to do it?

Currently what I do is very tedious especially when the jar is big.
Enumeration en = jf.entries();
then process each element in enumeration and see whether it's belong to the path.

Is there any easier way that I can list all the files with same path?
 
Norm Radder
Bartender
Posts: 1362
14
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Not yet. The only way I know is how you're doing it.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic