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
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
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
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
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