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: Static executables


Mohan Embar wrote:
Tom Tromey wrote:

It would be helpful if someone wrote a page for the gcc wiki about
static linking.

Like this:?


http://gcc.gnu.org/wiki/Statically%20linking%20libgcj


I wish I had that reference awhile ago.

One variation on this:

object dummy = new fully.qualified.name.of.missing.Class();

is this:

Class dummy = fully.qualified.name.of.missing.class;

(i.e. private static final Class c1 = gnu.java.locale.Calendar.class)

This avoids creating a new instance, which may not always
be possible.


If you are compiling from classfiles (pre 1.5) the .class construct will not force a link (as it just does a Class.forName() or something like that).

But for compiling from .java source you are correct.

Also note that the dummy method is never run, it just forces the link to happen.

If you have a tested example using the .class method, you could update the Wiki.

David Daney.


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