Fork me on GitHub

I'm stumped on some java interop. The line with the comment is stumping me. Any help?


Why is it stumping you?


Like, you want to do what is in the comment?


I would suggest simplifying things to start by not using doto


I'm copying a bunch of code; everything else falls into place nicely, but I can't figure out how to translate that for interop....


(-> agent (.getPrinter) (.pushWriter (OutputStreamWriter. System/out)))


I'm having some Java interop trouble. This snippet does not work as expected:

(def watch-service ^java.nio.WatchService (.newWatchService (java.nio.file.FileSystems/getDefault)))

(def path ^java.nio.file.Path (java.nio.file.Paths/get (.toURI ( "resources"))))


;; => IllegalArgumentException: "No matching method register found taking 4 args for class sun.nio.fs.UnixPath"


java.nio.file.Path does have this method: register​(WatchService watcher, WatchEvent.Kind<?>... events)


if I reduce the number of arguments I instead get this: Cannot cast java.nio.file.StandardWatchEventKinds$StdWatchEventKind to [Ljava.nio.file.WatchEvent$Kind;


@christian767 try

(.register path watch-service
  (into-array WatchEvent.Kind [java.nio.file.StandardWatchEventKinds/ENTRY_MODIFY 


worked 🙂

👍 4

I’m trying to run Clojure on a Lego robot that has only 64mb of RAM (for fun). I’m actually able to get into repl using java -jar clojure.jar but when I try to use clj I get this nasty error

robot@ev3dev:~$ clj
OpenJDK Client VM warning: INFO: os::commit_memory(0xa9340000, 179044352, 0) failed; error='Not enough space' (errno=12)
# There is insufficient memory for the Java Runtime Environment to continue.
# Native memory allocation (mmap) failed to map 179044352 bytes for committing reserved memory.
# An error report file with more information is saved as:
# /home/robot/hs_err_pid4931.log
Are there some knobs I could tweak to make clj work on low-end hardware or should I just forget about it?


I installed clj with the Linux installer script from I’m not sure if it’s even supposed to work with ARM processors..?


It can, given your JVM runs on arm


And given you have a bash compatible shell


@valtteri afaik, the default max heap is set to something like 256m. Does running something like clj -J-Xmx32m help?


Nope, it gives the same error


setting both Xms and Xmx to 32m?


if still not, then its beyond me 😞


Nope, but thanks anyway!

Alex Miller (Clojure team)13:10:33

clj runs 2 JVMs - one to compute the classpath, one to run your repl/app

Alex Miller (Clojure team)13:10:04

There is a min heap fixed for the first one and I suspect it’s too high for you

Alex Miller (Clojure team)13:10:03

You could edit the clojure script and remove the one place with -Xms and see if that works


I almost know how to use slack.. AWESOME! I removed all -Xms 256mb switches from the script and it got clj running 👍 Thanks @alexmiller But now I think I have some kind of an SSL problem which is in the snippet above

Alex Miller (Clojure team)13:10:00

Sorry, don’t know what that is


No problem, I’ll try to hack my way around it.

Alex Miller (Clojure team)13:10:46

Might be a mismatch in what TLS level is being used on client vs what is allowed by server

Alex Miller (Clojure team)13:10:35

There is an https.protocols System property you could look at


Someone has an idea why lein fails to download the nrepl:nrepl:jar:0.6.0, clojure-complete:clojure-complete:jar:0.2.5 and viebel:codox-klipse-theme:jar:0.0.5 dependencies from while all other deps download fine from clojars? So no network issue.


Looking at clojars, they should are there using these coordinates.

Noah Bogart15:10:59

You can edit posts if you need to!

Noah Bogart15:10:13

Long press on mobile or click the 3 dots on desktop/web


Old IRC habits, sorry. Thanks for the reminder.

Noah Bogart16:10:05

Of course! Not everyone knows about it


Solved the issue: The project.clj was setting the clojars URL to . explicitly. Changing that to fixed it, all deps could be found and downloaded.


I created a POM on my laptop using clj -Spom and now I’m attempting mvn dependency:resolve. It’s giving warnings about not being able to fetch descriptors but it seems to be downloading the deps anyways. Everything just takes super long with this hardware. 😄


I ended up wrapping clojure and other libs into an uberjar on my mac, shipping it to the robot and running with rlwrap java -jar robo-test-0.1.0.jar. My guess is that the SSL problems have something to do with the custom JDK13 that I’m using. I’ll try next weekend clj with JDK12. Nevertheless, I’m now able to live-code the robot from the REPL and I feel super empowered! 💪


i also had ssl problems on arm when i used adoptjdk's version


if you do the stuff just for fun then you can try azul's zulu jvm , this one worked as expected out of the box


(i ended up going for a 64 bit raspberry linux instead in the end and could use openjdk's official package from ubuntu's repo again, so i don't use zulu anymore)


Good to know! I’ll probably give zulu a spin.


What is right and common name for situation when you validate data and values depend on each other. For example check if date of birth is lower, than date of graduation or password repeat. I am asking, because I am writing article and right name matter for me 🙂 Not sure which one is the right one. I found Coercion idiomatic here but hmm I don’t feel it is the right one.


It is a constraint, the valid values for date of birth constrain the valid values for date if graduation and vice versa


Coercion is not that at all. Coercion is changing some value into another


Calling it a constraint draws analogies with database schema which are often good analogies for spec

👍 4