On Mon, Jun 11, 2012 at 11:50 PM, Denis Vulinovich
<[email protected]> wrote:
> RT.loadResourceScript("bar.clj");
You talk about putting the .class files on your classpath (modulo the
correction to add the classes subdirectory as Jacek noted) but you are
trying to load a source file (from the classpath).
Here's what works for me:
* add the src path (in your Leiningen project) to your classpath
* load a namespace like this: RT.var( "clojure.core", "load" ).invoke(
"/sample/bar" );
* obtain a reference to the hello function as before:
> Var foo = RT.var("sample.bar", "hello");
You don't need to compile Clojure to .class files in order to be able
to load it into your Java code - it will be compiled on the fly.
As your Clojure code grows and depends on other libraries, you'll need
to ensure those are also on your classpath (lib/*.jar from your
Leiningen project).
--
Sean A Corfield -- (904) 302-SEAN
An Architect's View -- http://corfield.org/
World Singles, LLC. -- http://worldsingles.com/
"Perfection is the enemy of the good."
-- Gustave Flaubert, French realist novelist (1821-1880)
--
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