On Tue, Sep 18, 2012 at 12:39 PM, Jim - FooBar(); <jimpil1...@gmail.com> wrote: > On 18/09/12 17:28, Aaron Cohen wrote: > > What did you use to compile this? I don't believe hyphens are legal in > Java package names. > > > I used regular > > javac -cp blah:blah:blah encog-java/customGA/*.java > > the compiler did not complain because the actual package declaration uses > underscore instead of hyphen. > yes hyphens are indeed illegal... that is, you cannot write "package > foo-bar;" but you can write "package foo_bar;" when in fact being in the > "foo-bar" folder. > > It will be hard to use this in clojure, clojure converts hyphens to > underscores automatically behind the scenes in package names. But your > package actually has a (possibly invalid) hyphen in it's name, so the > mangling prevents your class from being found.
I was actually wrong here, I think. I should probably check closer, but I now think that clojure only mangles its own package names when necessary. I don't think it ever mangles doing pure interop. > exactly!!! when I ask from clojure (:import [encog-java.customGA aClass]) > clojure should convert the hyphen to match the actual package found in the > declaration of class files. UNderscores are certainly legal characters...the > thing is, it doesn't matter whether i use an underscore or not when > importing - I always get the same error which makes me slightly > suspicious... > > In my desperation, I went into my ~/.m2 directory and actually modified the > jar by hand so the folder "encog-java" was renamed to "encog_java" but again > the same story! I don't get it!!! I actually just tried this (I don't recommend this approach though), and it worked for me, maybe you missed a step. I think you'll have best luck if you make your directory structure match the package name. --Aaron -- 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