I am making a game in JAVA where I want to come up with a list of files in a certain directory in my jar so I can make sure to have a list of those classes to be used in the
Probably the best approach is to list the classes at compile time.
There is a fragile runtime approach. Take you Class (MyClass.class of this.getClass()). Call getProtectionDomain. Call getCodeSource. Call getLocation. Call openConnection. (Alternatively open a resource.) Cast to JarURLConnection. Call getJarFile. Call entries. Iterate through checking getName. I really do not recommend this approach.