U
ufmemo
I have what seems to me to be a simple question -- but everything I've
tried hasn't worked.
What I would like to do is the following:
In a J2EE (Websphere) app I am building a framework where I need to
dynamically instantiate and run specific methods on all of the classes
in a package. I can guarantee that 1) I know the package name 2) there
will be one or more classes in this package but will not know how many
until run time 3) that all classes will implement a specific interface.
I could do this by using Java I/O getting the listing of the directory
that houses these classes, and then iterate over this list dynamically
instantiating these classes and invoking the methods defined by the
interface. The problem is that since I am doing this in the J2EE world
I have no idea where this package will live when deployed, and
consequently where these classes will live. I have looked at the
possibility using the classloader as a possible way to list all the
classes in a package, java i/o and the servlet context to see if I can
get a directory listing of the package that way, and even Jakarta
discovery all to no avail.
Does anyone have a suggestion for me? Thanks in advance.
tried hasn't worked.
What I would like to do is the following:
In a J2EE (Websphere) app I am building a framework where I need to
dynamically instantiate and run specific methods on all of the classes
in a package. I can guarantee that 1) I know the package name 2) there
will be one or more classes in this package but will not know how many
until run time 3) that all classes will implement a specific interface.
I could do this by using Java I/O getting the listing of the directory
that houses these classes, and then iterate over this list dynamically
instantiating these classes and invoking the methods defined by the
interface. The problem is that since I am doing this in the J2EE world
I have no idea where this package will live when deployed, and
consequently where these classes will live. I have looked at the
possibility using the classloader as a possible way to list all the
classes in a package, java i/o and the servlet context to see if I can
get a directory listing of the package that way, and even Jakarta
discovery all to no avail.
Does anyone have a suggestion for me? Thanks in advance.