Reputation: 1879
Ultimately, I want the following to work
(ns grizzler.core
(:import (com.sun.grizzly.http.embed GrizzlyWebServer)
(com.sun.grizzly.tcp.http11 GrizzlyAdapter)))
However, I have no idea how to go about this. Do I add stuff to my classpath? Where do I modify my classpath, in my .bashrc or within clojure?
I've found the grizzly project at http://grizzly.java.net/. But what do I download? How do I install things? I really just have no idea what to do.
Related: Using 3rd party java libraries, like com.jcraft.jsch, with clojure - except that it's not detailed enough for me :(
Edit: I also tried the following in project.clj and it didn't work:
(defproject grizzler "1.0.0-SNAPSHOT"
:description "FIXME: write description"
:dependencies [[org.clojure/clojure "1.3.0"]
[com.sun.grizzly.http.core "2.1.10"]
[com.sun.grizzly.http.embed "2.1.10"]
[com.sun.grizzly.tcp.http11 "2.1.10"]])
In addition, I tried net.java.grizzly.http.core , and that didn't work either.
Thanks!
Upvotes: 2
Views: 364
Reputation: 91617
The current consensus on the "right" way to do this is basically "use leiningen". Leiningen is basically a wrapper around maven and uses maven repositories. Most of the time you can find the code you need in a maven repository somewhere, though eventually you will be in this situation where you need to use a jar file. In this case you install the jar file into your local maven repository which lives in your home directory and contains copies of all the jars required to build all your projects. In cases where the jars you depend on are available from a central repo this local repo acts as a cache so you don't have to download them every time, though you can manually put jars into your local repo if it can't automatically download them.
I recommend watching this video first.
lein new nameOfYourProject
project.clj
lein deps
lein deps
again to make sure it finds itimport
statement in your .clj file (as you have above)Debugging this process can be very situation specific, but the denizens of #clojure are usually quite helpful.
Upvotes: 4