0

How would I find a class that extends another abstract class?

Currently I have this:

public PluginFinder(ClassLoader cl, File f) throws MalformedURLException, ClassNotFoundException {
    super(new URL[]{f.toURI().toURL()}, cl);
    Class<?> jarClass = Class.forName("com.ngxdev.demoplugin.main.MainClass", true, this);
    this.instance = new PluginParser(jarClass).instance;
}

It works, but it's static, I need to find that "com.ngxdev.demoplugin.main.MainClass" without specifying it because the location can be "com.example.ExampleClass" for all I know.

I tried to use: Reflections reflections = new Reflections("my.project.prefix"); but I don't really know how to use it.

Community
  • 143
  • 2
  • 10

1 Answers1

0

Reflections can also scan files, for example:

Reflections reflections = new Reflections(new File("/plugin/example.jar"));

Using this libary

Community
  • 143
  • 2
  • 10