I'm trying to develop a JavaFX application. I've to create a plugin system. My application is composed with a GridPane with 4 places where I want to insert 4 AnchorPanes.
I want that this AnchorPanes to be plugins. I've got the following architecture :
My Application
+ src
+ controller
+ view
+ Main.java
+ res
+ lib
+ plugin
+ plugin.jar
+ plugin
+ Controller.java
+ view.fxml
I want to call dynamically my plugin with a loader.
FXMLLoader loader = new FXMLLoader();
loader.setLocation(new URL(path));
pane = loader.load();
If I don't touch to anything, I've got the following error :
java.lang.ClassNotFoundException: plugin.Controller
If I right-click on my .jar and I select "Add as library" in my IDE, it works perfectly. But, I want to add my plugins dynamically so I must not do this manipulation. I think it's a problem of ClassPath but i don't know how to resolve it.