With that I can find the package name within an application
Package pack = Item.class.getPackage();
But all examples which I can find here or elsewhere to find the classes in a package use file to load a jar and look into that. I there a way to gat a classes list within active project without file ?
[EDIT] there are othere answers here but they all didn't work for me
[Edit] is for some reasons this has been blocked for answers. here is the solution
private static Set<Class<? extends Object>> getClassesInPackage(String packagename) {
List<ClassLoader> classLoadersList = new LinkedList<ClassLoader>();
classLoadersList.add(ClasspathHelper.contextClassLoader());
classLoadersList.add(ClasspathHelper.staticClassLoader());
Reflections reflections = new Reflections(new ConfigurationBuilder()
.setScanners(new SubTypesScanner(false /* don't exclude Object.class */), new ResourcesScanner())
.setUrls(ClasspathHelper.forClassLoader(classLoadersList.toArray(new ClassLoader[0])))
.filterInputsBy(new FilterBuilder().include(FilterBuilder.prefix(packagename))));
Set<Class<?>> classes = reflections.getSubTypesOf(Object.class);
return classes;
}