[jsword-devel] private JRE, Harmony, RCP, pack200 etc

Zhaojun Li(李召军) lzj369 at gmail.com
Fri Jan 26 10:40:40 MST 2007

If you go to Sun's website, you will notice that the jre installer for
JRE6 only 12mb. It uses pack200 to compress jar files. It is good at
compressing jars. sometimes, we can get 50-80% size reduction. I think
the bigger you jar size is, the higher you compress rate you get.

Pack200 comes with JRE , depends on JRE. So when we compress, we need
jRE installed. However, when we expand it, we use unpck200. It comes
with jre 5 6 and is a c++ programe,. Included also a dll.
Look at the following: the command I used to compress that JRE lib folder:
pack200 --no-gzip --effort=9 --deflate-hint=false
--modification-time=latest --unknown-attribute=strip  jce.pack		
pack200 --no-gzip --effort=9 --deflate-hint=false
--modification-time=latest --unknown-attribute=strip	jsse.pack		
pack200 --no-gzip --effort=9 --deflate-hint=false
--unknown-attribute=strip	management-agent.pack	 management-agent.jar
pack200 --no-gzip --effort=9 --deflate-hint=false
--modification-time=latest --unknown-attribute=strip	resources.pack		
pack200 --no-gzip --effort=9 --deflate-hint=false
--modification-time=latest --unknown-attribute=strip	-J-Xmx256m
rt.pack			 rt.jar
pack200 --no-gzip --effort=9 --deflate-hint=false
--modification-time=latest --unknown-attribute=strip	-J-Xmx256m
charsets.pack		charsets.jar

(Notice that big jars need to limit the memory usage , or we get out
of memeory error)
to expend:

jre\bin\unpack200.exe -r -q jre\lib\rt.pack		jre\lib\rt.jar

This way, we can reduce the size of JRE like 50%.
Then we use 7zip or NSIS to compress the JRE by using LZMA, thus got
8.7 mb jre, it contains charset.jar too.

For Cross, I post the NSIS script for you here, you know what is going
on there because I see in SVN , BD was built by NSIS too.

I think java5 and java6 did a good job. Sun is trying to make it
better very hard.


On 1/26/07, DM Smith <dmsmith555 at yahoo.com> wrote:
> Zhaojun,
> I looked at distributing the JRE with BibleDesktop as part of the
> "Portable BibleDesktop" effort (see www.crosswire.org/~dmsmith/bd). The
> goal here was to have it fully expanded so that it would work on a
> CD-ROM or a USB drive on any platform. I too found that it is big.
> I would be very interested to know how you recompressed the JRE and how
> you would expand it again upon delivery.
> As far as BibleDesktop goes, we are stuck with Sun's implementation of
> Swing. I think that JSword or Common can use most 1.4 level JREs. I had
> problems with IBMs JRE and I think it had to do with charsets, but I'm
> not sure.
> The exciting part of RCP/JFace/SWT is that we could use other JREs,
> including GNU's and Apache's.
> I read the license for Harmony and clause 4 gives us the right to
> distribute.
> DM
> Zhaojun Li(李召军) wrote:
> > Hi,
> >
> > I found that distributing java application anoying because it needs
> > JRE on users desktop. We have no control on what on users' system.
> >
> > One solution is to distribute a private JRE with our application. JRE
> > 5 and 6 are all too big. According to Sun, we have to distribute many
> > jars that not needed at all in order to comply with the license.
> >
> > I removed those files that are optional in JRE , unfortunately I can
> > not remove charset.jar because of internationalization.  I was able to
> > comrpess JRE, RCP to a size of 9mb. Very impressive.  Still plus my
> > plugins, the size goes to 12mb.
> >
> > I notice harmony has an JRE under apache license. and all the jars are
> > modular. I am not good at apache license. Does it allow us to remove
> > the components? I think so.
> >
> > I tested Eclipse on Harmony, it runs well. Apache also claims it
> > supports eclipse.  That means we can distribute a working JRE without
> > AWT,SWING and other components we do not need for RCP.  I expect after
> > compression, the JRE can be like 2-4 MB.
> >
> > Any inputs?
> >
> > Zhaojun
> >
> _______________________________________________
> jsword-devel mailing list
> jsword-devel at crosswire.org
> http://www.crosswire.org/mailman/listinfo/jsword-devel

More information about the jsword-devel mailing list