Can't delete/remove unloaded plugin
See original GitHub issueHi, I found a little issue. I don’t know if it’s only on my end.
How to reproduce it:
- Start the application and install a plugin
- After installing it, deactivate it
- Restart your application -> The plugin won’t be started by application
- Try to delete (
pluginManager.deletePlugin(plugin.getPluginId());) the plugin. - A ClassNotFoundException is thrown

If I activate the plugin and then tries to delete/remove it there is no issue. The same if I activate the plugin and then deactivate it again and then tries to delete/remove it.
The problem occurs only if I try to delete/remove a plugin which was not loaded/started by application with application-start.
Tested on macOS 10.14.4 with Java 1.8.0_202
Issue Analytics
- State:
- Created 4 years ago
- Comments:10 (6 by maintainers)
Top Results From Across the Web
What to Do When You Can't Delete a WordPress Plugin
You need to first deactivate the plugin before you can completely delete it from your website. To deactivate a plugin, click on Deactivate ......
Read more >How to Uninstall a WordPress Plugin (the Proper Way) - Kinsta
Browse to your /wp-content/plugins/ folder. Then delete the plugin folder from your server. Delete plugin via FTP Delete WordPress plugin via ...
Read more >How to remove your plugin completely - WordPress.org
1. Click “Plugins” in the vertical WordPress admin menu. ... 3. Click the “Deactivate” link which is under the plugin name. 4. Click...
Read more >How to Properly Uninstall a WordPress Plugin (Beginner's ...
To uninstall a plugin, go ahead and click on the 'Delete' link below the plugin name. WordPress will now ask you to confirm...
Read more >How To Delete & Reinstall Plugins - YouTube
This video looks at how to delete and install/reinstall plugins both via WordPress and manually using FTP or File Manager. #avad...
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

The problem is related to https://github.com/pf4j/pf4j/issues/242 (Add delete hook method in Plugin). I will take a look and I will come with a solution asap.
I think that I found a solution to solve the problem in an elegant mode with few modifications. My idea is to retrieve the plugin instance before the plugin will be unloaded. See below the modifications as diff:
@meydominic Please make above modifications on your machine. Build and test the new PF4J version on your use case (application). If the result is OK please let me know to commit the modifications on GitHub. Thanks!