Clojure REPL not picking environment variables

It seems the Clojure REPL (Tools | Start Clojure Console) does not pick up environment variables.  The following comes back empty,

(prn (into {} (System/getenv)))

However, in a Run/Debug configuration, I get environment variables.

The missing environment variables seem to cause a problem when I try to run an executable using  Any ideas on how to get Clojure REPL to pick up environment variables?


Hi Michael.

There is no way to specify environment variables for REPL from IntelliJ. This functionality will be added to REPL settings soon.
For now, as a workaround, specify environment variables explicitly in the REPL using with-sh-env form.



Thanks for the quick reply.  Btw, I really like the restructuring of the clj menu times into Clojure REPL and Start Clojure Console.


Does anyone have an example of how to "specify environment variables explicitly in the REPL using with-sh-env form"? I don't have any success finding examples. Specifically I assume I need to update the existing map, which is read-only. This is all a bit tricky for me, I'm trying to get labrepl working so I can learn some clojure, so  an exact example would be much appreciated




I haven't quite figured it out but it seems to be something along the lines of:

( {"SYSTEMROOT" '("C:\\windows")})

Now this doesn't actually seem to work as intended (at least running (get (into {} (System/getenv)) "SYSTEMROOT") returns nil), but it does run.

Any suggestions?



Sorry Mark - Beyond my expertise with the Java/Clojure environment currently...



Please sign in to leave a comment.