0

I want to make an application that can dynamically load java modules.

The problem is that MainApp must have all libraries used in modules.

For example i tried load module with external library and i cant run application without loading same library into MainApp.

Is there any way to load library dynamically into MainApp to preserve modularity of the application or any other solution for this problem?

Examples appreciated, thanks.

edit

Simple example

MainApp:

List<ModuleInterface> listOfModules = ModuleInterface.getInstances();

this list contains modules loaded using ServiceLoader

SampleModule:

public class DummyModule implements ModuleInterface{
    @Override
    public String doSomething() {
        //format gson for example
        return "Formated string";
    }
}

If i try in MainApp call doSomething() i can't because im missing gson library in MainApp.

Darko
  • 11
  • 2

0 Answers0