Re: NullPointerExecption after Java class import

2010-08-31 Thread Stuart Campbell
You could call (import) directly after you've initialised the Gate class: (gate-init "foo") (import gate.Factory) ; use Factory class as required Cheers, Stuart On 31 August 2010 01:01, zm wrote: > > Initialization exception can be avoided if Factory class is > initialized indirectly: > > (let

Re: NullPointerExecption after Java class import

2010-08-30 Thread zm
Initialization exception can be avoided if Factory class is initialized indirectly: (let [factory (.newInstance (Class/forName "gate.Factory"))] ...) The problem is that Factory can only be initialized (its static fields) after Gate.init was called. But clojure reader (or what it is) initializes

Re: NullPointerExecption after Java class import

2010-08-30 Thread zm
Indeed if exception is thrown in static initializer block then clojure import throws exception as well. The following class will cause this: package aaa; public class Test { static{ Object o = null; o.toString(); } } Then in clojure: (ns x (:impo

Re: NullPointerExecption after Java class import

2010-08-29 Thread Stuart Campbell
Hello, I don't know this library specifically, but the NPE is probably occurring in a static initialisation block. I believe static initialisation occurs when the class is first loaded. Regards, Stuart On 30 August 2010 06:42, zm wrote: > > I am using GATE java libs in my clojure code and beha

NullPointerExecption after Java class import

2010-08-29 Thread zm
I am using GATE java libs in my clojure code and behaviour of the application changes after Java class import. I don't even have to initialize it. This runs fine (a bit shorter version than it is): (ns gate (:import (gate Gate) (java.io File))) (defn gate-init [gate-home] (Gate