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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 16, 20262026-05-16T10:23:58+00:00 2026-05-16T10:23:58+00:00

Separate Jars When creating JAR files, I’ve always kept the source separate and offered

  • 0

Separate Jars

When creating JAR files, I’ve always kept the source separate and offered it as an optional extra.

eg:

  • Foo.jar
  • Foo-source.jar

It seems to be the obvious way to do things and is very common. Advantages being:

  1. Keeps binary jar small
  2. Source may not be open / public
  3. Faster for classloader? (I’ve no idea, just guessing)

Single Jar

I’ve started to doubt whether these advantages are always worth it. I’m working on a tiny component that is open-source. None of the advantages I’ve listed above were problems in this project anyway:

  1. Classes + source still trivially small (and will remain that way)
  2. Source is open
  3. Class loading speed of this jar is irrelevant

Keeping the source with the classes does however bring new advantages:

  1. Single dependency
  2. No issues of version mismatch between source and classes
  3. Developers using this jar will always have the source to hand (to debug or inspect)

Those new advantages are really attractive to me. Yes, I could just zip source, classes and even javadoc into a zip file and let clients of my component decide which they want to use (like Google do with the guava libraries) but is it really worth it?

I know it goes against conventional software engineering logic a little, but I think the advantages of a single jar file out-weigh the alternatives.

Am I wrong? Is there a better way?

  • 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-16T10:23:59+00:00Added an answer on May 16, 2026 at 10:23 am

    Yes, I could just zip source, classes and even javadoc into a zip file and let clients of my component decide which they want to use (like Google do with the guava libraries) but is it really worth it?

    Of course it is worth it! It takes about 2 seconds to do it, or just a few minutes to change your build scripts.

    This is the way that most people who distribute sources and binaries handle this problem.

    EDIT

    It is not your perspective you need to consider. You have to think of this from the perspective of the people deploying / using your software.

    • They aren’t going to use the source code on the deployment platform.
    • Therefore putting the source code in the binary JAR is a waste of disc space, slows down deployment and slows down application startup.
    • If they want to do something about it, they’ve got a problem. How do they rebuild the JAR file to get rid of the source code? How do they know what is safe to leave out?

    From the deployer / user’s perspectives, there are no positives, only negatives.

    Finally, your point about people not being able to track source versus binary versions doesn’t really hold water. Most people who would be interested in the source code are perfectly capable of doing this. Besides, there some simple things you can do to address the issue, like using JAR filenames that include your software’s version number, or putting the version number into the manifest.

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

Sidebar

Related Questions

I have a package for R which contains several jar files. For better maintenance
How can I get tar/cp to copy only files that dont end in .jar
I want a separate configuration for each of my war files and I want
Instead of creating separate questions for each, here's a list of XCode 4 related
I want to use Maven to create two separate jars for my project. One
I've got a Maven project and we want to build two separate jars, one
In spring-js.jar, there is a bunch of spring js files and css files compressed
I seem to be having a problem setting multiple JAR files to the classpath
I have 2 separate modules in separate .jars which operate on 2 different databases.
Can Maven create two jars specified in one pom.xml: one jar with my app

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.