Re: Java Native Interface - static something

From: Ryan Stewart (zzanNOtozz_at_gSPAMo.com)
Date: 02/04/04


Date: Wed, 4 Feb 2004 07:16:41 -0600


"Maria Gaitani" <M.Gaitani@warwick.ac.uk> wrote in message
news:4020d196$0$15423$fa0fcedb@lovejoy.zen.co.uk...
> Hi!
>
> I am trying to programme some java native interface but I'm still in the
> process of research.
> I've seen examples such as this one
> http://java.sun.com/docs/books/tutorial/native1.1/stepbystep/step1.html
>
> but I don't understand the third and fourth line of the code of the above
> example:
>
> static {
> System.loadLibrary("Hello"); }
>
> I understand it is calling the library ... what I don't get is the
structure
> static { }.
> I'd be grateful if you could explain what this structure is ...
>
> Thank you
> Maria

In general, the first time a class or one of its fields is referenced, its
static initializers are executed. I don't know where to find an exact
definition of what happens when.