I'm fairly new to Clojure and Java. When I try to call Clojure code
from Java, I get an error "java.io.FileNotFoundException: Could not
locate Clojure resource on classpath: bar.clj".
I've created a simple project in Eclipse with one Java file:
package sample;
import clojure.lang.*;
public class foo {
public static void main(String[] args) throws Exception {
RT.loadResourceScript("bar.clj");
Var foo = RT.var("sample.bar", "hello");
Object result = foo.invoke("world");
System.out.print(result);
}
}
This calls bar.clr:
(ns sample.bar)
(defn hello [name]
(str "Hello," name))
I'm using Leiningen with project.clj:
(defproject sample "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]]
:aot [sample.bar])
When I run "lein compile", it creates three bar*.class files in C:\dev
\vaadin\sample\classes\sample. My Java classpath (in Windows) is C:\dev
\vaadin\sample.
Thanks for your help.
--
You received this message because you are subscribed to the Google
Groups "Clojure" group.
To post to this group, send email to [email protected]
Note that posts from new members are moderated - please be patient with your
first post.
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/clojure?hl=en