Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

getResource - Traverse directory in jar

807601Jun 13 2008 — edited Jun 14 2008
Hi

I have a directory called "SupportingFiles" in my Java project, and this is included in the jar. During runtime I would like to use all the ".txt" files available in that directory. Basically I am trying to get a list of all "*.txt" files available in "SupportingFiles".

I have tried various ways with this.getClass().getResource() and this.getClass().getResourceAsStream(), but no luck.

Could anyone help me in getting this done? Basically I want to traverse all the "*.txt" files in a directory which is enclosed in the jar.

Thanks
Srikanth
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jul 12 2008
Added on Jun 13 2008
5 comments
820 views