Search code examples
clojurepublic-method

How do I call a non-public method of a public class in Clojure?


I'm calling the twitter4j library using Clojure like so:

(def twitter (. (TwitterFactory.) getInstance))

This works fine when I call it as a script. But when I use gen-class, I get:

java.lang.IllegalArgumentException: Can't call public method of non-public class: public java.lang.Object twitter4j.TwitterFactoryBase.getInstance()

Is there a workaround for this?


Solution

  • I have no experience with it myself, but Meikel Brandmeyer did a nice writeup on gen-class once, maybe that will help you:

    http://kotka.de/blog/2010/02/gen-class_how_it_works_and_how_to_use_it.html