get package classes

Discussion in 'Java' started by Chameleon, Apr 27, 2005.

  1. Chameleon

    Chameleon Guest

    Can I have an enumeration/vector/array or something with all classes
    of a package?

    I have a class script.Compile and I want this class enumerate all
    classes inside package script.functions

    I try class "Package" but I cannot found a method like "getClasses()" or
    "getClassesNames()"
    Chameleon, Apr 27, 2005
    #1
    1. Advertising

  2. Chameleon <> writes:

    > Can I have an enumeration/vector/array or something with all classes
    > of a package?


    No: Packages do not exist as "objects", since a class in a package can
    be anywhere on the classpath. The VM only knows about the classes that
    have been loaded.

    You can roll your own scanner of the classpath of course.
    Tor Iver Wilhelmsen, Apr 27, 2005
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Carfield Yim
    Replies:
    1
    Views:
    1,424
    Andrew Thompson
    May 31, 2004
  2. Stefan Haun

    get classes from package

    Stefan Haun, Jul 30, 2004, in forum: Java
    Replies:
    1
    Views:
    2,821
    Chris Smith
    Jul 30, 2004
  3. Christian Bongiorno
    Replies:
    5
    Views:
    541
    Chris Uppal
    Aug 30, 2004
  4. Tomasso

    Get classes from package

    Tomasso, May 23, 2006, in forum: Java
    Replies:
    9
    Views:
    6,153
    Furious George
    May 25, 2006
  5. aeonsun
    Replies:
    4
    Views:
    571
    Paul Cager
    Jul 27, 2006
Loading...

Share This Page