English Deutsch Français Italiano Español Português 繁體中文 Bahasa Indonesia Tiếng Việt ภาษาไทย
All categories

A programmable way of enumurating java classes with-in a certain packge.

So the result will be a list, something like this:
List l = getClasses("java.lang")
// l == {"String","Thread",...}

Or something similar ?
Is there a way to do this?

thanks in advance!

2006-11-12 05:53:16 · 1 answers · asked by Yuval 2 in Computers & Internet Programming & Design

1 answers

If you know the package name (like in your example), then look at this:
http://forum.java.sun.com/thread.jspa?threadID=341935&start=15

To get to that point from any given object, get the object's class, and then get the Package object.

Class clazz = myObj.getClass();
Package package = clazz.getPackage();
String packageName = package.getName();

2006-11-13 06:17:58 · answer #1 · answered by vincentgl 5 · 0 0

fedest.com, questions and answers