You need to import the classes from that library and then wrap them up
with some Clojure code.

Here a snippet:

(ns myname.space
  (:import (org.apache.commons.logging LogFactory Log)) ;; Import from 
commons-logging the LogFactory and Log classes

)
...

;;
;;      Get a logger for the current namespace
;;
(defn get-logger [] (LogFactory/getLog (str
*ns*)))

I do not used common-net yet so I do not know the API and how it
should be used. You will have to look at the JavaDoc and figure this
out.

If you want you can spare the imports but then you will need to refer
to the classes with their full name:

(defn get-logger [] (org.apache.commons.logging.LogFactory/getLog (str
*ns*)))

Luc P.

On Wed, 19 Jan 2011 16:49:11 -0800 (PST)
Andreas Kostler <andreas.koestler.le...@gmail.com> wrote:

> Hi All,
> Can someone please tell me how to import the Apache commons net
> library? I'm using leiningen. The project.clj looks like this:
> (defproject clojure-scheme "1.0.0-SNAPSHOT"
>   :description "FIXME: write"
>   :dependencies [[org.clojure/clojure "1.2.0"]
>                  [org.clojure/clojure-contrib "1.2.0"]
>                  [commons-net/commons-net "2.2"]]
>   :dev-dependencies [[swank-clojure "1.2.2"]]
>   :main clojure-scheme.core)
> 
> Which puts commons-net-2.2.jar in the lib directory of my project.
> How can I import and use functionality in clojure? I want to do
> something like
> (def telnet (new TelnetClient)) ... but all attempts failed so far.
> 
> Kind Regards
> Andreas
> 



-- 
Luc P.

================
The rabid Muppet

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