Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

FileNotFoundException Could not locate clojure/java/jdbc__init.class

I have a problem with importing jars in clojure. I used lein to add dependencies. This is code from project.clj

(defproject recommendation "0.1.0-SNAPSHOT"
:description "FIXME: write description"
:url "http://example.com/FIXME"
     :license {:name "Eclipse Public License"
      :url "http://www.eclipse.org/legal/epl-v10.html"}
      :dependencies [[org.clojure/clojure "1.5.1"]
                     [org.clojure/java.jdbc "0.0.6"]         ;; jdbc 
                     [mysql/mysql-connector-java "5.1.6"]]
  :aot :all
  :main recommendation.core)

I typed in the command lein deps, and it downloaded 3 jars in lib folder.

This is code from recommendation.core

(ns recommendation.core
(:require [clojure.java.jdbc :as sql]) )

And I get exception:

FileNotFoundException Could not locate clojure/java/jdbc__init.class or clojure/java/jdbc.clj on classpath:   clojure.lang.RT.load (RT.java:443)

Can anybody tell me where i am wrong and what to do?

like image 825
user3549602 Avatar asked Apr 18 '14 17:04

user3549602


1 Answers

here's my dependency line:

[org.clojure/java.jdbc "0.2.3"]

Heres the require line from one of my projects that use jdbc

(:require [clojure.java [jdbc :as sql]])

If none of this helps here are my standard leiningen fixing steps:

  1. lein deps and look for errors
  2. lein clean
  3. lein upgrade
  4. lein deps :tree and look for strangeness
  5. rm -rf target/ # this one has only helped me with messed up native deps.
  6. rm ~/.m2/repository -rf # this is the last resort, it's lots of downloading.
  7. join #leiningen on irc.freenode.net and ask for help

PS: I found this video helpful in getting a handle on namespaces.

like image 194
Arthur Ulfeldt Avatar answered Oct 03 '22 07:10

Arthur Ulfeldt