(. (. java.lang.System out) (println "Cool! Lisp in Java"))
=> Cool! Lisp in Java
nil
(new java.util.Date)
=> Wed Oct 17 20:01:38 CEST 2007
(. (new java.util.Date) (getTime))
=> 1192644138751
However, I did not get the example on the Getting Started page to
work. I tried to work it out myself but the following, which I would
guess should work, does not work:
=> (. (new javax.swing.JOptionPane) (showMessageDialog nil "one"
"two" (. javax.swing.JOptionPane ERROR_MESSAGE)))
java.lang.Exception: REPL:33: No matching method found
at clojure.lang.Compiler.analyzeSeq(Compiler.java:2535)
...
Pointers, anyone?
/Mathias
PS. First post! :)
My bad. That was a static method... This should work:
(. javax.swing.JOptionPane (showMessageDialog nil "one" "two" (.
javax.swing.JOptionPane ERROR_MESSAGE)))
But nothing happens. No error but I get no prompt back. Same with the
example on the intro page.
/Mathias
user=> (.. System out (println "This is even cooler!"))
This is even cooler!
nil
user=>
:)
On 17 Okt., 20:39, Mathias Dahl <mathias.d...@gmail.com> wrote:
> My bad. That was a static method... This should work:
>
> (. javax.swing.JOptionPane (showMessageDialog nil "one" "two" (.
> javax.swing.JOptionPane ERROR_MESSAGE)))
>
> But nothing happens. No error but I get no prompt back. Same with the
> example on the intro page.
Works for me here, with java 1.6.0 on Linux. As well as the two arg
version:
(. javax.swing.JOptionPane (showMessageDialog nil "Hello, world!"))
On 17 Okt., 22:10, Stefan Lang <langste...@gmx.at> wrote:
> Hello,
>
> On 17 Okt., 20:39, Mathias Dahl <mathias.d...@gmail.com> wrote:
>
> > My bad. That was a static method... This should work:
>
> > (. javax.swing.JOptionPane (showMessageDialog nil "one" "two" (.
> > javax.swing.JOptionPane ERROR_MESSAGE)))
>
> > But nothing happens. No error but I get no prompt back. Same with the
> > example on the intro page.
Now I can reproduce your problem. It happens after I hit a cursor
key, which enters an escape sequence in my terminal, then hit Enter,
giving the exception "java.lang.Exception: Unable to resolve symbol:
in this context..."
Then when I try to show a dialog is behaves as you describe. In fact,
anything I enter afterwards just causes the REPL to hang. Seems to
mess up the reader or compiler.
Everything works again after restarting the REPL.
When testing at home, under GNU/Linux, it works for me as well. I
should have mentioned that the problem I had was under Windows XP.
Unsure of Java version, will check tomorrow.
Hehe :) Yes, I noticed after reading further in the manual... :) Neat!
Speaking of terminals: I was a bit annoyed by the lack of line editing
(the cursor keys just output escape sequences for me too, under gnome-
terminal). Emacs to the rescue (as usual)! I started M-x shell and ran
Clojure from there. Instant hit! :) Completion, history et al.