Can you provide some more details, like what kind of environment? A standalone app, a webapp in a application server. Where are the classes loaded from? JARs, separate files on a file system, a network class loader etc.
There is no simple answer, simply because there is no simple definition of a package. A package can be spread over multiple jars, multiple class loaders, and in the case of network class loaders, the classes exist on another machine.
Finally, do you want to just consider classes that are loaded in the VM or all classes present on the classpath?
EDIT: See also this related question.