Hi,

lein run looks for a -main function in your source file. This is a
convention
borrowed from java (and other languages).

The null pointer exception is probably lein or clojure looking for -main.

> echo '(defn -main [] (println "no exception)' >> src/foo/core.clj
> lein run -m foo.core
hello
asdf

Ambrose

On Mon, Apr 18, 2011 at 7:48 PM, lesni bleble <lesni.ble...@gmail.com>wrote:

> hello,
>
> i'm trying to start learning clojure with lein but i get into
> trouble.  I'm doing simple project:
>
> > lein new foo
> > cd foo
> > lein deps
> > echo '(println "hello")' >> src/foo/core.clj
> > lein run -m foo.core
> hello
> Exception in thread "main" java.lang.NullPointerException
> (NO_SOURCE_FILE:1)
>        at clojure.lang.Compiler.eval(Compiler.java:5440)
>        at clojure.lang.Compiler.eval(Compiler.java:5415)
>        at clojure.lang.Compiler.eval(Compiler.java:5391)
>        at clojure.core$eval.invoke(core.clj:2382)
>        at clojure.main$eval_opt.invoke(main.clj:235)
>        at clojure.main$initialize.invoke(main.clj:254)
>        at clojure.main$null_opt.invoke(main.clj:279)
>        at clojure.main$main.doInvoke(main.clj:354)
>        at clojure.lang.RestFn.invoke(RestFn.java:421)
>        at clojure.lang.Var.invoke(Var.java:369)
>        at clojure.lang.AFn.applyToHelper(AFn.java:163)
>        at clojure.lang.Var.applyTo(Var.java:482)
>        at clojure.main.main(main.java:37)
> Caused by: java.lang.NullPointerException
>        at user$eval13.invoke(NO_SOURCE_FILE:1)
>        at clojure.lang.Compiler.eval(Compiler.java:5424)
>        ... 12 more
>
> obviously my code ((println "hello")) was executed followed by
> exception which i don't understand.  What is wrong?
>
> --
> 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 this group, send email to
> clojure+unsubscr...@googlegroups.com
> For more options, visit this group at
> http://groups.google.com/group/clojure?hl=en

-- 
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 this group, send email to
clojure+unsubscr...@googlegroups.com
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en

Reply via email to