Re: help: a question for creating JAR file

Discussion in 'Java' started by markspace, Feb 19, 2011.

  1. markspace

    markspace Guest

    On 2/18/2011 5:28 PM, www wrote:

    > Is there a smart way to do this? Both in Eclipse or using ANT.



    Yes, normally you build this as you add Jar files to your project.

    If you start with Apple and Peach, then add abc.efg.Cat and abc.xyz.Dog,
    you update your build files at that time. Both the normal build of just
    classes and the Jar file should be tested to make sure they both work.

    Then if you add a.b.Paw, then do so and test it right away. Leaving
    things to the last minute is a sure way to make it a big job.

    Most folks have a src/ director where all their files Java files go.
    Everything in this directory gets compiled and put into the final Jar
    file. So all you should do is drop the new files in there and voila, it
    builds and is put into the Jar.

    Most folks also keep a library/ for Jar files too, so that the binary
    are put on the class path during testing and somehow dealt with in the
    final deliverable Jar.

    You seem to be implying that there are dependencies in the files
    themselves. Well that happens. The right thing to do is to choose Jar
    files that document their dependencies. If DogCat.jar also requires
    Paw.jar, then it should darn well say so in the documentation.

    If instead you get DogCat.jar and it's a mess of unresolved dependencies
    and missing documentation, well that's a hint to chuck the thing out and
    find a better library.

    If these are internally generated files, then you need procedures and
    discipline in place so each developer knows how check files into the
    repository so that all other developers know how to check them out with
    their dependent files. Again, the build/test process should verify that
    this was done correctly.
     
    markspace, Feb 19, 2011
    #1
    1. Advertising

  2. markspace

    Arne Vajhøj Guest

    On 18-02-2011 21:03, www wrote:
    > I am sorry. I cannot follow you. All these Java files were developed
    > by us in a couple years. Now, we need to give just a small part of our
    > code as JAR files to an outside organization since they have heard our
    > code is so good. So, it is "last minute" thing. I don't want to wrap
    > the whole tree to give them. I want the JAR file as slim as possible.


    You digged a hole and now you need to climb up from it.

    I don't think there are any good shortcuts.

    Best try would be to pack everything in a jar and the apply
    an obfuscater/shrinker to that jar file and tell it to remove
    unused stuff.

    Arne
     
    Arne Vajhøj, Feb 19, 2011
    #2
    1. Advertising

  3. On 19/02/2011 03:03, www allegedly wrote:
    > Now, we need to give just a small part of our
    > code as JAR files to an outside organization since they have heard our
    > code is so good.


    Wow awesome! Hey... uh... could you, maybe, tell me the name of those
    guys? I'm asking because I've got this Java library I've written a few
    week-ends back. It emulates an x86 processor, but is actually twice as
    fast as the actual processor it runs on! Do you think they might be
    interested in buying it? It wouldn't come cheap though.
     
    Daniele Futtorovic, Feb 19, 2011
    #3
  4. markspace

    Lew Guest

    Please do not top-post.

    www wrote:
    > I am sorry. I cannot follow you. All these Java files were developed
    > by us in a couple years. Now, we need to give just a small part of our
    > code as JAR files to an outside organization since they have heard our
    > code is so good. So, it is "last minute" thing. I don't want to wrap
    > the whole tree to give them. I want the JAR file as slim as possible.


    If the code depends on the other class, you have to include the other class.
    That *is* "as slim as possible".

    If you want to remove dependencies, you have to figure out which ones can be
    removed. As soon as you remove something that is actually used, you'll have a
    problem running the code.

    Tearing out what you think you don't need will have you tearing out your hair.
    It's doing the job backwards. Instead, build up from nothing to what you
    want. That way you include what you need, not remove what you don't.

    --
    Lew
    Honi soit qui mal y pense.
     
    Lew, Feb 19, 2011
    #4
  5. markspace

    Lew Guest

    On 02/19/2011 09:25 AM, www wrote:
    > On Feb 18, 10:00 pm, Daniele Futtorovic
    > <> wrote:
    >> On 19/02/2011 03:03, www allegedly wrote:
    >>
    >>> Now, we need to give just a small part of our
    >>> code as JAR files to an outside organization since they have heard our
    >>> code is so good.

    >>
    >> Wow awesome! Hey... uh... could you, maybe, tell me the name of those
    >> guys? I'm asking because I've got this Java library I've written a few
    >> week-ends back. It emulates an x86 processor, but is actually twice as
    >> fast as the actual processor it runs on! Do you think they might be
    >> interested in buying it? It wouldn't come cheap though.

    >
    > Sure. It's Apple company. Or, why don't you start your own company and
    > in a next few weekends buy Apple company directly?! Just remember to
    > let me know your company name.


    Based on what you're asking, it's really hard to believe your company's code
    is all that good. I wonder how you fooled Apple?

    --
    Lew
    Honi soit qui mal y pense.
     
    Lew, Feb 19, 2011
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. lucy
    Replies:
    6
    Views:
    30,971
    steve
    Sep 7, 2004
  2. Arnold Peters
    Replies:
    0
    Views:
    639
    Arnold Peters
    Jan 5, 2005
  3. muttley
    Replies:
    0
    Views:
    2,798
    muttley
    Oct 20, 2005
  4. cyberco
    Replies:
    4
    Views:
    3,877
    Roedy Green
    Feb 14, 2006
  5. Arnold Peters
    Replies:
    0
    Views:
    705
    Arnold Peters
    Jan 5, 2005
Loading...

Share This Page