I am trying to install Clojuratica and am getting this error
IllegalStateException Can't dynamically bind non-dynamic var: clojuratica.runtime.dynamic-vars/*kernel* clojure.lang.Var.pushThreadBindings (Var.java:353)
When executing this command:
(def math-evaluate ^:dynamic (math-evaluator kernel-link))
from the instructions on this page:
http://clojuratica.weebly.com/tutorial.html
The error looks like it's something to do with this page:
https://github.com/gasc/Clojuratica/blob/master/src/clj/clojuratica.clj
Anyone know how this could be fixed?
Your version of Clojuratica seems to require an a version of clojure < 1.3.0 because it does not mark it's dynamic variables as such (and at that time it was not required).
It looks like the latest version on the projects github page fixes this.
Related
before I start, you probably need to know three things:
I don't have Java background
I'm a Clojure newbie - started to learn it
question is related to my "training" package kennyfy
TL;DR version I'm not able to import/use my training package in a project
Longer version
I set myself a goal - write simple API which converts text to kennyspeak. Before that I've created a package (using default lein template).
I tried to import this package to my API.
Part of project.clj looks like this:
:repositories [["jitpack" "https://jitpack.io"]]
:dependencies [[com.github.radmen/clojure-kennyfy "0.1.2"]]
lein deps fetches the package without any problems.
When I try to use it, Clojure fails with following message:
kennyfy-api.core=> (radmen.kennyfy/kenny-speak "foo")
ClassNotFoundException radmen.kennyfy java.net.URLClassLoader.findClass (URLClassLoader.java:382)
I understand the error, yet I've no idea why this class is not imported.
I am quite sure, that this may be related to the metadata stored in the package, which results in failed imports.
What am I doing wrong?
Thank you
$ java -version
openjdk version "1.8.0_192"
OpenJDK Runtime Environment (build 1.8.0_192-b26)
OpenJDK 64-Bit Server VM (build 25.192-b26, mixed mode)
$ lein version
Leiningen 2.8.3 on Java 1.8.0_192 OpenJDK 64-Bit Server VM
Clojure 1.9.0
A clojure namespaces is loaded the first time it is required.
foo.core=> (radmen.kennyfy/kenny-speak "foo")
Execution error (ClassNotFoundException) at java.net.URLClassLoader/findClass (URLClassLoader.java:382).
radmen.kennyfy
foo.core=> (require '[radmen.kennyfy :as kennyfy])
nil
foo.core=> (kennyfy/kenny-speak "foo")
"mpfppfppf"
foo.core=> (radmen.kennyfy/kenny-speak "foo")
"mpfppfppf"
foo.core=>
When I add :repl-options {:init (print "x..")} to ~/.lein/profiles.clj it does what it should on every repl start-up. however, when I add the same to my local project.clj, I receive this error:
Exception in thread "main" java.lang.RuntimeException: Unable to resolve symbol: do in this context, compiling:(/tmp/form-init5885833654225579206.clj:1:886)
I'm using leiningen 2.5.3
I've stumbled across this issue as well - I tried to use multiple profiles, each with its own :repl-options.
The issue is that Leiningen doesn't merge `:init: correctly. You can refer to this issue for more details.
Unfortunately, I couldn't find any fix that would work for me. And the issue itself won't be fixed till Leiningen 3.0.
I experience the following error:
CompilerException java.lang.RuntimeException: No such var: user/help, compiling:(/private/var/folders/xy/8l2mmnsj0gv3myj72y0s2kmr0000gn/T/form-init6632573911186472967.clj:1:10884)
#<Namespace user>
Error loading namespace; falling back to user
This only happens in this one project. The project happily compiles to uberjar, and lein run works just fine, it's only the repl that doesn't work.
Anyone have any idea what this could be about?
The entire project is available at https://github.com/Skinney/coc-helper
I stumbled upon this question because I had the same problem. I have opened an issue for that problem, with minimal reproducing project and workaround, on the Leiningen github project.
Since the OP has apparently already solved the problem, here is the TL;DR for anyone else arriving here: the problem is that you require :as user in the main namespace. Changing the alias solves the problem, as the OP has done in this commit.
What should I do to get doc available again?
brew install --devel leiningen
lein new app yeehaw
cd yeehaw
; edit project.clj and replace "1.4.0" with 1.5.0-RC1"
lein repl
yeehaw.core=> (doc map)
CompilerException java.lang.RuntimeException: Unable to resolve symbol: doc
in this context, compiling:(NO_SOURCE_PATH:1:1)
This change comes from CLJ-1085 and this associated source.
Note that doc and the usual REPL functionality is still available in the user namespace, but it would be nice to have it at my fingertips in my app's namespace, at least while in the REPL.
Get doc into current namespace:
(clojure.core/use '[clojure.repl :only (doc)])
And after that try doc again.
Thanks to help from clojure IRC, here are some options:
use clojure.repl/doc instead of doc
use (apply require clojure.main/repl-requires) to bring doc and other REPL functionality into a new namespace.
I am trying to compile some Clojure code to Java using the Clojure 1.2 compiler. I am including the Clojure and Clojure-contrib 1.2 jars in the classpath. When I do the compile it fails and I get the folowing error:
Exception in thread "main" java.lang.ClassNotFoundException: clojure.contrib.io.Streams (io.clj:121)
: Has anyone seen this before?
Update:
Here is the line I use to compile my clj files:
java -cp "..\lib\h2.jar;..\lib\vaadin-6.4.4.jar;..\lib\clojure.jar;..\lib\clojure-contrib.jar;..\lib\wlfullclient-10.3.0.0.jar;..\..\..\..\..\jre1.6windows32bit\lib\rt.jar;." -Dclojure.compile.path=cljclasses clojure.lang.Compile oe.main.oe-main
clojure.contrib.io.Streams is a protocol defined in clojure.contrib.io
To help you more you have to share more details about how and what you are trying to compile.
use (compile 'oe.main.oe-main) from a clojure REPL using the same class path, and this works