Simple jar reference not working

16 views
Skip to first unread message

Doug Hill

unread,
May 30, 2015, 11:59:26 PM5/30/15
to clojured...@googlegroups.com
Hi, all. I'm new to Clojure and am working through the examples in Halloway's book Programming Clojure. I am not new to Eclipse, having used it for Java and R development, which is the reason I decided to try CounterClockwise as my Clojure environment. 

The project I'm working on was created using the New/Clojure Project option in CCW.

My problem is that even after adding a particular clojure jar file, clojure-contrib.jar, to Referenced Libraries via the Project Properties/Add External Jar, I still can't successfully (use <namespace>) any of the namespaces in that file - I get FileNotFound errors. I've attached a screenshot showing the commands I've tried, the library reference, and errors I get. As I recall, adding a jar file that way always made its packages available in my Java code. 

I've found posts from other users with similar problems, and a common thread is that the Leiningen project.clj file needs to be edited. Since I just want to learn Clojure I'd really rather not have to worry about build tool plumbing at this point, I just want to get a simple REPL environment running and be able to reference local jar and clj files as needed. Hopefully there's a simple way to do that which leverages Eclipse's features in a way I'm familiar with.

My project.clj is:

(defproject test "0.1.0-SNAPSHOT"
  :description "FIXME: write description"
  :license {:name "Eclipse Public License"
  :dependencies [[org.clojure/clojure "1.6.0"]])

It did not change when I added the jar reference.

Thanks, Doug

post.png

Laurent PETIT

unread,
May 31, 2015, 12:12:11 AM5/31/15
to clojured...@googlegroups.com
Hello Doug,

I think I can help you. 

- currently counterclockwise, indeed, encourages to use leiningen from start. So, by default, it will call leiningen executable to start a new repl. And the leiningen executable has no idea of what you have manually added to the eclipse Java build path. 
- fortunately enough, there's a solution. There's an eclipse preference to start the repl using the eclipse Java build path. It's just that it's not selected by default. You will find it in Preferences > Clojure > General > use leiningen to start new repl (from memory, should be this approximately). 

- please also note that once you have launched a repl, further additions to the Java build path (either manually or through project.clj - the latter not being your case yet), you'll need to restart the repl (dependencies won't be added automatically - this could be a great addition, though, feel free to file an issue for it!)

HTH,

Laurent
--
You received this message because you are subscribed to the Google Groups "counterclockwise-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to clojuredev-use...@googlegroups.com.
To post to this group, send email to clojured...@googlegroups.com.
Visit this group at http://groups.google.com/group/clojuredev-users.
For more options, visit https://groups.google.com/d/optout.


--
Laurent Petit

Doug Hill

unread,
May 31, 2015, 10:39:45 AM5/31/15
to clojured...@googlegroups.com
Thanks so much Laurent, that did the trick. Now I only have to climb one learning curve at a time!
To unsubscribe from this group and stop receiving emails from it, send an email to clojuredev-users+unsubscribe@googlegroups.com.
To post to this group, send email to clojuredev-users@googlegroups.com.


--
Laurent Petit

Reply all
Reply to author
Forward
0 new messages