package demo
public class counter{
int c = 0;
public void increment()
{
++c;
}
public int get()
{
return c;
}
public static int sqr(int x)
{
return x*x;
}
}
2) Using in Clojure:
; To get this to run in SLIME do the following (where we're in demo/ to start):
;;
;; > javac counter.java
;; > cd ../
;; > jar cvf demo.jar demo
;; > mv demo.jar lib/
;;
;; Remember we were in demo/ to start. The directory lib/ is created when we
;; run lein new. So now we have the jar file we created placed with all of the
;; other jar files on the classpath. So we can continue:
;;
;; > lein swank
;;
;; Now start up emacs and M-x slime-connect (accepting 127.0.0.1 and 4005 defaults).
;; At the repl in emacs do
;;
;; user> (import '(demo counter))
;; user> (counter/sqr 4)
Thanks, I really appreciate any help!
-Dave