This is the mail archive of the java@gcc.gnu.org mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: building a standalone executable


On Sat, 25 May 2002, David Young wrote:
> But is there a way to create a standalone Java executable?

Yes, with a few caveats.  The difficulty is not the VM itself...
interpreters can easily be made small and embeddable (as any Forth user
knows).

The large size of the core java.* and javax.* classes are a
bigger problem for standalone programs.  These account for most of
the libgcj runtime, which currently stands over 6MB compiled (on
i686-linux).  However if size is unimportant to you, one option is to
link standalone programs with all of libgcj included.

Using "gcj -static" is a bit of a compromise: it'll link all classes that
are referenced (at compile time) directly or indirectly by your code.
This way gcj will always grab too many classes, and sometimes too few.
Static linking isn't a great solution, but the reality is that you simply
cannot tell exactly what classes will be needed from a compile-time
analysis.

It turns out to be difficult in practice to produce useful standalone
programs with gcj smaller than one megabyte or so.  (There have been
numerous experiments done by Adam Megacz and others; search the list
archives for details.)

> In 
> particular, I was looking for a way to allow people to download a single 
> package and run the executable directly, rather than having to install 
> several other packages as prerequisites.  Would this mean that I would 
> have to include libgcj into the single package?  Does libgcj's license 
> allow that?

The intent of the libgcj license is to permit linking with non-GPL code.
For specific licensing questions I suggest contacting the FSF.

Jeff


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]