File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
The moose likes Java in General and the fly likes Basic Reflection Problem Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Java in General
Bookmark "Basic Reflection Problem" Watch "Basic Reflection Problem" New topic

Basic Reflection Problem

Sashi Gundoji

Joined: Jan 30, 2007
Posts: 10
Hi all,

I am new to Java and I am having basic question about reflection.

I am having one main package and under main package I have several other package. See below example.

I need to search from main package to find all test files and get all variables of test files.

I need to search the whole main package.

Is it a good idea to use reflection or some other way. If reflection is good, then I would like to know how can I get all packages references by using reflection.



thanking you,

Ernest Friedman-Hill
author and iconoclast

Joined: Jul 08, 2003
Posts: 24199

There are no reflection calls to get a list of all packages, or a list of all classes in a package, because both of these are potentially unlimited lists. If this is a development environment and you're looking at class files laid out on disk, just use to look at them. If the classes are in JAR files, then use the java.util.jar.JarFile class directly.

[Jess in Action][AskingGoodQuestions]
I agree. Here's the link:
subject: Basic Reflection Problem
It's not a secret anymore!