2

Is it possible to get all the packages and classes from a source directory (eg. from src/main/java) using Java? (looking at Classpath and Package does not seems achievable).

I am open to another language if it is unachievable in Java.

Anil Bhaskar
  • 3,718
  • 4
  • 33
  • 51
  • runtime? compile time? source directory or classpath? or both? – eis Aug 01 '17 at 06:55
  • @eis It is to find classes in package, given `String package`, I am trying to traverse through a source directory, providing you have access to it. It is an independent program from the compile, run scope of these classes. – Anil Bhaskar Aug 01 '17 at 07:03
  • Basically list files (and folders) recursively in your source directory ? – Jeremy Grand Aug 01 '17 at 07:11
  • You can use library for do it in reflection: https://github.com/ronmamo/reflections – aarexer Aug 01 '17 at 07:11
  • @AnilBhaskar the duplicate I linked should answer to that question. Basically, use reflections library as suggested. – eis Aug 01 '17 at 07:16

0 Answers0