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 8255147
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T01:25:35+00:00 2026-06-08T01:25:35+00:00

I’m searching for a way to make a library replaceable. For example: I have

  • 0

I’m searching for a way to make a library replaceable.
For example: I have a library which is managing communication over multicast . I’m using that library in my main application. My idea was to use an interface for that:

public interface MessageHandler {
    public void sendMessage();
    public Message receiveMessage();
}

Now it should be possible to change the library. For example a library which is managing communication over broadcast. Both are implementing the same interface.

So in my main application I want to have the opportunities:

MessageHandler mHandler = new MulticastImpl();

Or

MessageHandler mHandler = new BroadcastImpl();

My problem is: Where do I place the interface definition? When I place it into my main application I can’t see it from the library (because the library don’t know the main application).
When I place it into the both libraries I have two different MessageHandler-Interfaces (for example com.multicast.MessageHandler and com.broadcast.MessageHandler)

Any ideas?

  • 1 1 Answer
  • 0 Views
  • 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-06-08T01:25:36+00:00Added an answer on June 8, 2026 at 1:25 am

    This is a basic plugin system. what you should do is:

    1. put the plugin API in a standalone jar.
    2. include this plugin API jar in the main application.
    3. plugin implementations should not include the plugin API (they will just use it for compiling).
    4. provide a way for the user to specify the “implementation” class for the plugin (as a configuration String)
    5. on application startup, use reflection to load the implementation class from the configuration.

    Note, there are more sophisticated ways to load plugins in java (e.g. using java.util.ServiceLoader and/or nested classloaders), but this is a good start.

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

Sidebar

Related Questions

I am using this python library that implements the Aho-Corasick string searching algorithm that
I am searching for a way to make an application helper that allows you
I have been searching for a way to make a menu come 80 pixels
so I've been searching without end to find a simple way to make tabs
I'm searching for a way to create a menu in an iPhone app that
I've been searching for a way to make a textarea type inside of itself.
I searching a way to map the Bson objects defined using readable names (category)
I'm searching way to make arc with Bresenham's line algorithm. This algoritm draw perfect
Introduction I've always been searching for a way to make Visual Studio draw a
Is there any way to make a key for searching the values in 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.