Hi all,

I'm running into a problem with Java code using records defined in
Clojure (1.2.0) code.

Here's the Clojure code:
(ns t.core
  (:gen-class))
(defrecord TRecord [a b c])
(compile 't.core)

I run Lein (1.3) to compile this and generate a jar file. Inside the
jar file I see an entry for the record class:
t/core/TRecord.class

Then I try to compile Java code to use it:

import java.lang.reflect.Method;
import t.core;
import t.core.TRecord;

class Main {
        public static void main (String [] args) {
                try {
                        Class trClass = Class.forName ("t.core.TRecord");
                        System.out.println ("trClass: " + trClass);
                        Method trMethods [] = trClass.getDeclaredMethods ();
                        for (Method trMethod : trMethods) {
                                System.out.println ("trMethod: " + trMethod);
                        }
                } catch (Exception e) {
                        e.printStackTrace ();
                }
        }
}

Attempting to compile this with the jar in the classpath produces a
"cannot find symbol" error for the TRecord class. It does however
compile with the last import line commented out, and when run this
successfully prints out the name of the class and its methods.

I'd like to just import the TRecord class, and instantiate and use
TRecord objects. Any idea what I'm missing here?

Thanks for any help with this.

-Earl

-- 
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