Re: Simple Clojure/Java interop

2011-04-18 Thread MohanR
Thanks. There is no NPE now. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from th

Re: Simple Clojure/Java interop

2011-04-18 Thread Meikel Brandmeyer
Hi, On 18 Apr., 09:43, MohanR wrote: > user>( defn logtrace[message]( ; <- paren? >   (let [logger (org.apache.log4j.LogManager/getLogger "Stream")]( >     .log logger org.apache.log4j.Level/FATAL message >   ) > )) ; <- paren? > ) You don't say what the exception is, but I suspect a NPE. If it

Re: Simple Clojure/Java interop

2011-04-18 Thread MohanR
This method that makes a simple call to the log4j library throws an exception even though the message it written to the file. Not sure if there has something to do with static methods again. user>( defn logtrace[message]( (let [logger (org.apache.log4j.LogManager/getLogger "Stream")]( .log l

Re: Simple Clojure/Java interop

2011-04-07 Thread MohanR
That was my guess too and when I specify swank-clojure-extra-vm-args it seems to work. -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to clojure@googlegroups.com Note that posts from new members are moderated - pleas

Re: Simple Clojure/Java interop

2011-04-07 Thread Sean Corfield
Ah, static initializers... Well, I expect your initializer (in Java) is running before the Clojure code has had a chance to set the property... On Thu, Apr 7, 2011 at 8:56 PM, MohanR wrote: > > (let [ test (LogManager/getLogger "Stream")]) > > This code inside the same clojure function is suppose

Re: Simple Clojure/Java interop

2011-04-07 Thread MohanR
(let [ test (LogManager/getLogger "Stream")]) This code inside the same clojure function is supposed to call a static method of a Java class and in the Java class there is a static initializer. That initializer calls System.getProperty( "Test" ) This is compiled from within emacs C-c C-l. Not AO

Re: Simple Clojure/Java interop

2011-04-07 Thread Sean Corfield
I tried it in the REPL and it seemed to work fine: user=> (use 'clojure.test) nil user=> (deftest testlogging (System/setProperty "Test" "Test1") (let [ configfile (System/getProperty "Test")] (is (= "Test1" configfile )) )) #'user/testlogging user=> (run-tests) Testing user Ran 1 te

Re: Simple Clojure/Java interop

2011-04-07 Thread Armando Blancas
There's nothing wrong there. Would need to see the java snippet how is called. On Apr 6, 11:03 pm, MohanR wrote: > This is a beginner's question but I thought I might be missing > something. > > I am setting a System property and testing for it like this. It > passes. > >  ( deftest testlogger >