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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T10:24:36+00:00 2026-05-29T10:24:36+00:00

I have a server application and two Swing-based client applications. We’re developing them in

  • 0

I have a server application and two Swing-based client applications. We’re developing them in eclipse and there’s a separate project for each.

Many classes are shared. For example, the my.server package has some classes for both the server and the clients while others are for the server only. Although I prefer to put them in the same package because they are closely related and some of them rely on package visibility, I don’t want to distribute classes that an application does not need as not only would it bloat the file size, but also it would be a security risk.

At the moment, each of the server and the clients has the same jars, which is a mess. Ideally, I’d like to automatically create jars based on dependency as following.

Server:

  • server.jar: classes used by Server only
  • server-client1-common.jar: classes shared by Server and Client 1
  • server-client2-common.jar: classes shared by Server and Client 2

Client 1:

  • client1.jar: classes used by Client 1 only
  • server-client1-common.jar: classes shared by Server and Client 1
  • client-common.jar: classes shared by Client 1 and Client 2, but not Server

Client 2:

  • client2.jar: classes used by Client 2 only
  • server-client2-common.jar: classes shared by Server and Client 2
  • client-common.jar: classes shared by Client 1 and Client 2, but not Server

I realize that you can do this manually using ant, but it would be a maintenance disaster. Is there a tool that takes care of such dependency automatically?

  • 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-05-29T10:24:37+00:00Added an answer on May 29, 2026 at 10:24 am

    One of the best practices regarding building applications is to have one jar per project.

    Maven, for example, uses this as default. You can trick it to do otherwise, but it is better to join them instead of “fight” them.

    http://maven.apache.org/guides/mini/guide-using-one-source-directory.html

    http://www.sonatype.com/people/2010/01/how-to-create-two-jars-from-one-project-and-why-you-shouldnt/

    So, in your case you should create 6 projects:
    Server, Client1, Client2, ServerClient1Common, ServerClient2Common, ClientCommon

    In order to select the classes needed, I don’t think there is a tool, and probably you should know better what is the common functionality.
    Create the Common projects, and add them to the build path – dependencies. Then start moving your classes into the Common project, leaving them in the same package.

    For example, create ServerClient1Common project.
    For Client1, go to Configure Build Path -> Projects. Add ServerClient1Common. Remove all references to Server Project.
    For Server, go to Configure Build Path -> Projects. Add ServerClient1Common. Remove all references to Client1 Project.

    You should now have a lot of missing classes/imports. Try to solve them one by one.

    At the end, you should be able compile the 3 projects and to obtain the jars you mentioned.

    PS: Other strategies (like one uber-project with different build targets, or 3 projects with entwined ant/maven builders) are messier. There is maybe one exception – another way of splitting the classes, but I do not know if it applies to you: client1.jar, client1-interface.jar, client2.jar, client2-interface.jar, server.jar, server-interface.jar. This way you could use 3 projects with each having two target jars. To run client2.jar you will need server-interface.jar

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

Sidebar

Related Questions

I have a client-server application, where there two options for the server - standalone
I have two projects in my solution Client Server Both compile to console applications.
I have two applications. One is a Java thick client Swing GUI for controlling
I have two applications: c++ service and a RoR web server (they are both
If you have two applications residing on the same server, can you use Server.Transfer
I have two web applications in the same server like this: /basedir/app1path/default1.aspx /basedir/app2path/default2.aspx How
I have two web applications that are running on a single Tomcat server and
I have a Client/Server application, where the Client and Server have some common tables
I have a client server application with multi-threading. The server side is failing with
I have an application that I will run on two separate emulators. This application

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.