I've been trying to create a program that goes through a subfolder and adds all the .java files within to a list in the code, so I can access it later.
I can easily get all the file directories in a string list, but what i'm having trouble with is getting the program to add them in without the class needing to be defined.
Since i feel that's confusing here's an example:
In minecraft there are a ton of types of blocks. In my program, it would add a bunch of them to a list without needing to specifically reference that block like this:
list.add(new DirtBlock());
So is it possible to add a class to the program from inside the code?
I know it's possible in python because Crea did this kind of thing, but I haven't seen it done in java before.