Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 1063109
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T18:44:06+00:00 2026-05-16T18:44:06+00:00

I have a project which I want to add plugins. I have all the

  • 0

I have a project which I want to add plugins. I have all the interfaces/factories/etc. setup (my gateway interface is called ApplicationMonitorFactory), I just need to make a way to locate/activate the plugin. My configuration file is a java properties file.

I think what I need to do is:

  1. find a good way to specify a set of one or more plugins
  2. for each plugin, run it

1. find a good way to specify a set of one or more plugins

something like:

application.plugins=foo-monitor.jar,bar-monitor.jar

I think maybe it’s just best to specify a list of jar files; for each jar file specified, the implication is that it contains one or more classes which implement ApplicationMonitorFactory, and these are the ones that will be instantiated. (I might also add an annotation @ApplicationMonitorPlugin so that a .jar file can have a test ApplicationMonitorFactory that does not get instantiated)

Does this sound reasonable?


2. for each plugin, run it

I did this once a while back, and if I remember right I think I need to use a custom classloader to add the appropriate .jar file to the classpath dynamically. Or is there an easier way?

  • 1 1 Answer
  • 1 View
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-16T18:44:07+00:00Added an answer on May 16, 2026 at 6:44 pm

    Could I suggest using OSGI instead? If it’s a serverside project, something like Apache Karaf gives you quite a lot out of the box in terms of plugin deployment and specification.

    To answer the questions based on what you have at the moment:

    1. find a good way to specify a set of one or more plugins

    The properties file approach is fine. You may want to just be able to drop plugins into a folder that you monitor if you want hot deploy. Just having 1 jar file for a plugin does limit plugin developers to packaging all of their dependencies into a single jar file (maven shade plugin is useful for this). The annotation approach should work (the approach that Servlet 3.0 uses). Using OSGI, you’d have a manifest file with a Bundle-Activator property that would reference the plugin class that should be instantiated.

    2. for each plugin, run it

    Yes, you would need to fire up a class loader for the Jar files. This is where things get a bit hairier. It’s easy enough to do but Class loading has all sorts of gotcha’s. This is where OSGI would really help, even though it is a bit of an upfront cost.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a nearly ready project in Cocoa, for which I want to add
I have a Blackberry project in which I want to change normal image to
I have a project, in which I want to invoke another Jar file in
I have a static class in a shared project, which I want to extend
I have a project which uses strongly typed datasets. Let's assume I want to
I have a small Qt4 project which I want to build with cmake. It
I have project A, a C# console application which I want to reference my
Aloha I have a VS2008 solution to which I want to add a webservice
I am working on a project in which i want to add preloader and
I have a whole bunch of projects which I want to reuse between the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.