• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Is there a way to know classes in a package via a program

 
Ranch Hand
Posts: 413
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am not sure where to post this question but scenario is something like this
I need to know how many classes or objects are in a package and needs to provide a drop down for same in a jsp
When user select any option .It will execute that particular class's test method
I am using JUnit framework but question seem more relevant to something like reflection rather than testing

If any one has gone through this scenario please share your views
 
(instanceof Sidekick)
Posts: 8791
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
There is nothing in the APIs for this. You can try to learn the current classpath, iterate all the folders, jars, zips, etc. in the path and all the classes in each of those. I imagine IDEs like Eclipse must do something like this at startup but the JRE doesn't. Some of the entries in the classpath might be URLs, which won't have an easy way to list their contents.
reply
    Bookmark Topic Watch Topic
  • New Topic