I'm basically writing a jar to be used entirely from a Java application, in
Clojure. I don't know if it's better to just use Java for this yet, or not.
I'm experimenting, though.
I've got every namespace in my Clojure project compiling using AOT. In one
namespace, I use gen-class to create a class. In another namespace, I need
to create an instance of that class. Do I have to import that class like I
would Java classes? I've tried several methods and I keep getting class not
found exceptions.
Below is my pretty basic code:
*core.clj*
> (ns com.rycole.bukkit-plugin.core
>
> (:import [com.rycole.bukkit-plugin.listeners PlayerLoginListener])
>
> (:gen-class :name com.rycole.bukkit-plugin.core.Main
>
> :extends org.bukkit.plugin.java.JavaPlugin))
>
>
>> (defn -onEnable [this]
>
> (.info (.getLogger this) "PLUGIN ENABLED")
>
> (.registerEvents (.getPluginManager (.getServer this))
>> (com.rycole.bukkit-plugin.listeners.PlayerLoginListener.) this))
>
>
>> (defn -onDisable [this]
>
> (.info (.getLogger this) "PLUGIN DISABLED"))
>
>
*listeners.clj*
> (ns com.rycole.bukkit-plugin.listeners
(:gen-class :name com.rycole.bukkit-plugin.listeners.PlayerLoginListener
:implements org.bukkit.event.Listener
:methods [[^{org.bukkit.event.EventHandler true}
> onPlayerLoggedIn [org.bukkit.event.PlayerLoginEvent] void]]))
> (defn -onPlayerLoggedIn [this evnt]
(.info (.getLogger this) "PLAYER LOGGED IN"))
--
--
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