• Post Reply Bookmark Topic Watch Topic
  • New Topic

File.List() ??!  RSS feed

 
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
I want to list files in a specific directory. This works file using File.list() method while testing. But once the files are packaged in the jar file, I get a NullPointer exceptions. I look a the JAR API tells me that I should do thing differently. Nut how ?
How do you programamatically return the list of files in a directory of a jar file ? (like doing a : "jar tf" on the Jar)
 
Bartender
Posts: 9443
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
A quick look at the documentation for the java.util.jar.JarFile class reveals a method called entries() which says it "Returns an enumeration of the ZIP file entries".
 
raphael Bereh
Ranch Hand
Posts: 79
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I undestand that entries() applies to the whole jar , not a spefic folder in the jar, no ?
 
Joe Ess
Bartender
Posts: 9443
12
Linux Mac OS X Windows
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Correct.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!