Login  Register

Re: imageJ: setting a global static variable at startup

Posted by dscho on Oct 25, 2010; 10:29am
URL: http://imagej.273.s1.nabble.com/imageJ-setting-a-global-static-variable-at-startup-tp3686591p3686592.html

Hi,

On Mon, 25 Oct 2010, Giuseppe De Marco wrote:

> I don't now how to store a static variable into imageJ at startup.

Several options:

1) You can use ij.Prefs to store the variable under a certain name. If it
   is not set yet, ask the user. The good thing: ImageJ will take care of
   storing it persistently on disk.

2) You can use Java properties. They can be changed more easily, but
   you'll have to change the way ImageJ is started up.

3) Use Javascript in StartupMacros.ijm's AutoRun block to set a real
   static variable. Problem: you need to make sure that the class is
   loaded already.

There are probably many more ways...

Ciao,
Johannes