On Thu Mar  3 13:48 2011, Aaron Cohen wrote:
> On Wed, Mar 2, 2011 at 11:38 PM, Earl J. Wagner 
> <dont.spam.e...@gmail.com>wrote:
> 
> >
> > Then I try to compile Java code to use it:
> >
> > import java.lang.reflect.Method;
> > import t.core;
> > import t.core.TRecord;
> >
> > 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.
> >
> 
> Are you sure that the "Cannot find symbol" error is referring to the line
> "import t.core.TRecord;"?
> 
> I'm pretty sure the line before that: "import t.core;" is invalid, you can't
> import a package in Java (you could do "import t.core.*" if you wanted
> though).

Well, t.core exists because in his ns declaration he included
:gen-class.  Now, this isn't necessary for compiling records.  As for
why it isn't compiling, I am not sure.  I tried replicating the problem
(albiet without Leiningen), but was unable to.

Here is the code I used:

t/core.clj:

(ns t.core)

(defrecord TRecord [a b c])

(compile 't.core)

---

Main.java:

import t.core.TRecord;

public class Main {
    public static void main(String[] args) {
        System.out.println(new TRecord(1,2,3));
    }
}

----

Sincerely,

Daniel Solano Gómez

Attachment: pgpV5NxLCfRGU.pgp
Description: PGP signature

Reply via email to