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


Groups > comp.lang.java.programmer > #18365

Re: startup code

Path csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!eternal-september.org!feeder.eternal-september.org!newsfeed101.telia.com!starscream.dk.telia.net!fu-berlin.de!uni-berlin.de!individual.net!not-for-mail
From Robert Klemme <shortcutter@googlemail.com>
Newsgroups comp.lang.java.programmer
Subject Re: startup code
Date Tue, 28 Aug 2012 23:48:49 +0200
Lines 27
Message-ID <aa4sm3FtuvU1@mid.individual.net> (permalink)
References <9b4cce4e-99b1-414f-a033-1acf9200e90a@googlegroups.com> <2r4q38p3790lc86fpttn4arc58m5m1tjen@4ax.com> <3926176c-0940-4080-95a1-fb67bbbec50e@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-Trace individual.net 6yy5ASRMEHUvXnjOh0yZaAdrF6jbCwupuDmc8WcldqHj5Lm91TfJs9R9RtSiWDVUw=
Cancel-Lock sha1:zemTZoviNUf6eUHIBntt1DKX37M=
User-Agent Mozilla/5.0 (Windows NT 6.0; WOW64; rv:14.0) Gecko/20120713 Thunderbird/14.0
In-Reply-To <3926176c-0940-4080-95a1-fb67bbbec50e@googlegroups.com>
Xref csiph.com comp.lang.java.programmer:18365

Show key headers only | View raw


On 28.08.2012 23:00, Lew wrote:
> On Tuesday, August 28, 2012 11:53:34 AM UTC-7, Roedy Green wrote:
>> bob smith wrote, quoted or indirectly quoted someone who said :
>>> Is there any way to add code to a class that will get executed whenever the program starts up?
>>
>> You can put in it the main method or in a static init block.
>> See http://mindprod.com/jgloss/static.html
>
> The main method technique will happen whenever the program starts up.
>
> The class init block won't run until the class is initialized (not necessarily
> when it's loaded). This can be quite a while after the program starts "up".
> It can even be quite a while after the class is loaded.

Still it is often early enough, i.e. before instances of the very class 
get to do their work.

Bob, what are you trying to accomplish?  Or is this more like a homework 
question?

Kind regards

	robert

-- 
remember.guy do |as, often| as.you_can - without end
http://blog.rubybestpractices.com/

Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

startup code bob smith <bob@coolfone.comze.com> - 2012-08-28 11:48 -0700
  Re: startup code Roedy Green <see_website@mindprod.com.invalid> - 2012-08-28 11:53 -0700
    Re: startup code Lew <lewbloch@gmail.com> - 2012-08-28 14:00 -0700
      Re: startup code Robert Klemme <shortcutter@googlemail.com> - 2012-08-28 23:48 +0200
        Re: startup code Lew <lewbloch@gmail.com> - 2012-08-28 15:25 -0700
        Re: startup code Patricia Shanahan <pats@acm.org> - 2012-08-29 08:27 -0700
          Re: startup code bob smith <bob@coolfone.comze.com> - 2012-08-29 11:18 -0700
            Re: startup code Patricia Shanahan <pats@acm.org> - 2012-08-29 11:58 -0700
              Re: startup code Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-29 15:41 -0400
                Re: startup code Lew <lewbloch@gmail.com> - 2012-08-29 13:04 -0700
                Re: startup code Robert Klemme <shortcutter@googlemail.com> - 2012-08-29 22:06 +0200
                Re: startup code Eric Sosman <esosman@ieee-dot-org.invalid> - 2012-08-29 17:14 -0400
      Re: startup code Roedy Green <see_website@mindprod.com.invalid> - 2012-08-29 00:21 -0700
        Re: startup code Patricia Shanahan <pats@acm.org> - 2012-08-29 02:42 -0700
          Re: startup code Patricia Shanahan <pats@acm.org> - 2012-08-29 02:54 -0700
    Re: startup code Arne Vajhøj <arne@vajhoej.dk> - 2012-08-28 19:20 -0400
  Re: startup code Jeff Higgins <jeff@invalid.invalid> - 2012-08-28 15:22 -0400
  Re: startup code Arne Vajhøj <arne@vajhoej.dk> - 2012-08-28 19:19 -0400

csiph-web