Hi Robert,

the "standard answer" I guess: use the Singleton-Pattern (see "Design
Patterns" by Gamma, Helm, Johnson and Vlissidis) like this:

public class Gizmo {

    private static Gizmo instance = null;

    private Gizmo() {
    }

    public static Gizmo getInstance() {
        if (instance == null)
            instance = new Gizmo();
        return instance;
    }
}

and call Gizmo.getInstance() wherever you need it.

You do know that this is not really a Java-*Linux*-Question, right?

Stefan

PGP signature

Reply via email to