Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #30784 > unrolled thread

Using jar inside a jar

Started byCecil Westerhof <Cecil@decebal.nl>
First post2015-01-22 11:48 +0100
Last post2015-01-22 14:18 +0000
Articles 4 on this page of 24 — 10 participants

Back to article view | Back to comp.lang.java.programmer


Contents

  Using jar inside a jar Cecil Westerhof <Cecil@decebal.nl> - 2015-01-22 11:48 +0100
    Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-22 11:28 +0000
      Re: Using jar inside a jar Cecil Westerhof <Cecil@decebal.nl> - 2015-01-22 13:05 +0100
        Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-22 13:46 +0100
          Re: Using jar inside a jar Jeff Higgins <jeff@invalid.invalid> - 2015-01-22 08:15 -0500
            Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-22 16:30 +0100
          Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-22 14:18 +0000
            Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-22 16:29 +0100
              Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-23 11:10 +0000
                Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-23 13:12 +0100
                  Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-23 15:46 +0000
                    Re: Using jar inside a jar Eric Sosman <esosman@comcast-dot-net.invalid> - 2015-01-23 11:18 -0500
                    Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-23 22:42 +0100
                      Re: Using jar inside a jar Jerry Stuckle <jstucklex@attglobal.net> - 2015-01-23 17:02 -0500
                        Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-24 14:14 +0100
                          Re: Using jar inside a jar Martin Gregorie <martin@address-in-sig.invalid> - 2015-01-24 15:33 +0000
                      Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-26 09:28 +0000
                        Re: Using jar inside a jar Joerg Meier <joergmmeier@arcor.de> - 2015-01-26 21:14 +0100
                          Re: Using jar inside a jar Jerry Stuckle <jstucklex@attglobal.net> - 2015-01-26 15:23 -0500
                          Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-28 14:19 +0000
                Re: Using jar inside a jar Andreas Leitgeb <avl@auth.logic.tuwien.ac.at> - 2015-01-24 11:46 +0000
          Re: Using jar inside a jar Wayne <nospam@all.invalid> - 2015-01-23 00:47 -0500
          Re: Using jar inside a jar Silvio <silvio@internet.com> - 2015-01-23 12:28 +0100
        Re: Using jar inside a jar Nigel Wade <nmw@ion.le.ac.uk> - 2015-01-22 14:18 +0000

Page 2 of 2 — ← Prev page 1 [2]


#30833

FromAndreas Leitgeb <avl@auth.logic.tuwien.ac.at>
Date2015-01-24 11:46 +0000
Message-ID<slrnmc71ib.uoi.avl@login.logic.tuwien.ac.at>
In reply to#30813
Nigel Wade <nmw@ion.le.ac.uk> wrote:
> I'm not a fan of the "big jar" concept. I much prefer to keep libraries
> in separate jar's. If a library class gets updated it's only need to update
> a single library jar, rather than every "big jar" which contains that class.

Here's an (anecdotal) experience with a "big jar":

We have a small utility to send a "ping" to another app (and checking for
reply), using jmxterm.  We have a couple of "other apps", that are pinged
every minute.

We got jmxterm came as a jar-in-jar bundle, with some custom classloader
stuff in the outer jar file, that would make the inner jars' contents
loadable, and then start one of the embedded jars.

It turned out that that ping-utility (a shell-script starting jmxterm
and feeding it commands via System.in) took 10-20 CPU seconds to perform
a ping.
Unpacking the jar(once), and calling java with a -cp of all separate
jars reduced runtime to about 3-5 seconds.

If someone considers shipping their application as some jar-in-jar, it had
better be one where a couple more seconds of startup-time don't matter.

[toc] | [prev] | [next] | [standalone]


#30812

FromWayne <nospam@all.invalid>
Date2015-01-23 00:47 -0500
Message-ID<Tflww.411248$Sn4.369129@fx10.iad>
In reply to#30789
On 1/22/2015 7:46 AM, Joerg Meier wrote:
> On Thu, 22 Jan 2015 13:05:11 +0100, Cecil Westerhof wrote:
> 
>> It is not possible to use the jar that I put into the jar file? I
>> would prefer to use only one jar file. But if that is not possible, I
>> will go for option 3.
> 
> Certainly it is possible to pack everything into one jar, and that is what
> the vast majority of people do. I'm not sure why Nigel recommended none of
> the many standard solutions to this problem:
> 
> - FatJar
> - OneJar
> - Maven Shade
> - Maven Assembly
> - Gradle
> - WARs
> - Custom ANT task
> 
> Pick whichever you like best.
> 
> Liebe Gruesse,
> 		Joerg
> 

Google found another to add to your list:
  Capsule at <https://github.com/puniverse/capsule>

(Haven't used it yet.)

I don't believe Maven Assembly can be used to
create these "fat" (or "uber") jar files, and I
don't think that .war (or .ear) files can be made
to run with "java -jar" or by double-clicking.  But,
I haven't actually tried any of those solutions; I'd
love to hear from anyone who has used any of these
methods to produce a fat jar successfully.  Please
share your experiences!

-- 
Wayne

[toc] | [prev] | [next] | [standalone]


#30814

FromSilvio <silvio@internet.com>
Date2015-01-23 12:28 +0100
Message-ID<54c23051$0$2841$e4fe514c@news2.news.xs4all.nl>
In reply to#30789
On 01/22/2015 01:46 PM, Joerg Meier wrote:
> On Thu, 22 Jan 2015 13:05:11 +0100, Cecil Westerhof wrote:
>
>> It is not possible to use the jar that I put into the jar file? I
>> would prefer to use only one jar file. But if that is not possible, I
>> will go for option 3.
>
> Certainly it is possible to pack everything into one jar, and that is what
> the vast majority of people do. I'm not sure why Nigel recommended none of
> the many standard solutions to this problem:
>
> - FatJar
> - OneJar
> - Maven Shade
> - Maven Assembly
> - Gradle
> - WARs
> - Custom ANT task
>
> Pick whichever you like best.
>
> Liebe Gruesse,
> 		Joerg
>

Don't forget JARJAR

[toc] | [prev] | [next] | [standalone]


#30793

FromNigel Wade <nmw@ion.le.ac.uk>
Date2015-01-22 14:18 +0000
Message-ID<cicf4pFglsU1@mid.individual.net>
In reply to#30787
On 22/01/15 12:05, Cecil Westerhof wrote:
> It is not possible to use the jar that I put into the jar file?

You haven't put any jar into the jar file. It only contains the class files.
What you put into your jar is the MANIFEST, which tells Java where the other jar should be located.
The problem is that the other jar isn't where the MANIFEST says it should be.

> I
> would prefer to use only one jar file. But if that is not possible, I
> will go for option 3.

To do that you need to repackage the original jar into your own jar. The Java classloader won't look into jars contained 
in a jar.

[toc] | [prev] | [standalone]


Page 2 of 2 — ← Prev page 1 [2]

Back to top | Article view | comp.lang.java.programmer


csiph-web