Links

Lists

Latest Updates

Ruby On Rails List
Python list
Advanced Java
The JavaScript List
Apache Users
Full Disclosure
Linux Security

Search the archives!


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Advanced-java] Searching files in a classpath


  • From: Brian.Cain@xxxxxxxxxxxx (Brian Cain)
  • Subject: [Advanced-java] Searching files in a classpath
  • Date: Thu, 21 Feb 2002 14:16:52 -0500

On Thu, Feb 21, 2002 at 12:26:38PM -0600, Carl Swanson wrote:
> I have some files in my classpath I want to read from,
> but I don't know the names, how many, or even if they are there.
> 
> Is there any Java mechanism to search the class path
> to find them? Like all the files under a certain directory/package name?
> I know I can just open the dir handle and read them that way, but
> I thought there might be a better way.

Some methods to look at: ClassLoader.getResource*().  I don't know if 
you can iterate through all files in the classpath, but maybe.

-Brian