This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2022-06-15
Channels
- # announcements (13)
- # aws (6)
- # babashka (23)
- # babashka-sci-dev (6)
- # beginners (64)
- # calva (110)
- # cider (25)
- # cljs-dev (5)
- # cljsrn (8)
- # clojars (5)
- # clojure (20)
- # clojure-austin (1)
- # clojure-europe (77)
- # clojure-nl (1)
- # clojure-uk (3)
- # clojurescript (14)
- # cursive (7)
- # datahike (9)
- # datomic (13)
- # eastwood (15)
- # emacs (14)
- # figwheel-main (1)
- # fulcro (8)
- # graalvm-mobile (2)
- # graphql (2)
- # honeysql (2)
- # hyperfiddle (2)
- # introduce-yourself (4)
- # jobs (4)
- # joyride (4)
- # leiningen (4)
- # lsp (8)
- # minecraft (8)
- # off-topic (11)
- # polylith (18)
- # rdf (2)
- # reagent (3)
- # reitit (4)
- # remote-jobs (1)
- # shadow-cljs (39)
- # specter (7)
- # xtdb (3)
@thheller if I evaluate something that isn't bound like foo
or (foo)
with cider-eval-last-sexp
, it shows nil
rather than complaining about not being able to resolve the symbol. Is that likely to be related to your answer above too?
@ben735 with regular shadow-cljs node-repl
I get
cljs.user=> foo
------ WARNING - :undeclared-var -----------------------------------------------
Resource: <eval>:1:1
Use of undeclared Var cljs.user/foo
--------------------------------------------------------------------------------
cljs.user=> (foo)
------ WARNING - :undeclared-var -----------------------------------------------
Resource: <eval>:1:2
Use of undeclared Var cljs.user/foo
--------------------------------------------------------------------------------
@thheller thanks - and I appreciate that you don't use cider - I might report a bug for cider and see what others think
shadow-cljs might be doing something cider doesn't expect. could easily change that if somebody tells me what it expects instead.
When i start cider via cider-jack-in how is it picking a version of java and clojure to use? this is what i see at the top of the buffer in emacs
;; CIDER 1.5.0-snapshot (package: 20220531.616), nREPL 0.9.0
;; Clojure 1.9.0, Java 11.0.11
the clojure version matches the one in my deps.edn file, so i'm curious about the java version.
i'm guessing emacs is just searching my OS according to some set of rules. This is frustrating because it's probably not going to play nice with jenv
• java: it just invokes whatever process your project is based on: clj
, lein
, etc and does that. It doesn’t choose, just execs the program. Same as if you typed into a terminal clj
. The environment dictates the java version
• clojure: always from the project tool you are using, lein or clj
Welcome to the Emacs shell
~/projects/work/metabase $ which java
/Users/dan/.sdkman/candidates/java/current/bin/java
~/projects/work/metabase $
an easy way to remove this indirection. cider-jack-in
. grab the jack in command from the *Messages*
buffer. Save this form into a shell function. Then use that shell function to start the process and cider-connect
to it
which java from my emacs shell is saying ..jenv/shims/java and jenv version is openjdk...1.8 but the repl was starting with java 11.0.11 maybe it's ideal to just cider-connect (which is what your saying i suppose)
you might have to get into nitty gritty as to why you are getting different versions
emacs might not be “in the directory” you expect when it execs the process so maybe not getting the settings for that dir?
it's a thought, ill look into it more later 🙂 thanks for the help.
I believe the Clojure executable file will search the operating exec path, $PATH, to look for a java executable, so it may find a java on the PATH before it finds jenv Also check to see if JAVA_HOME is set to a particular path (although this is less used now)
To use cider-connect there is an example deps.edn alias here (remove the -i option if you want a headless process (i.e. no repl prompt in the terminal) https://github.com/practicalli/clojure-deps-edn/blob/live/deps.edn#L118
Thanks John. I'll take a look. Maybe i should use something that updates path to...
Depending on the environment, it may also be possible to set the java.runtime.version=17
or other version of Java in a system.properties
file in the root of the project, which can be useful when several versions of Java are available to the system. There are other properties, but it depends on the tooling as to if these properties are consulted.
https://practical.li/clojure-web-services/app-servers/java-system-properties.html
Or that property may be able to be set with a -J option on the command line, or with Cider including a :jvm-opts
key in an alias that is added to the cider-jack-in command (i.e. https://practical.li/spacemacs/clojure-projects/project-configuration.html). I am assuming an alias would be something like the following (but I havent tried this myself yet)
:jvm/report {:jvm-opts ["-Djava.runtime.version=17"]}
This might need "-Djava.home;/path/to/directory/containing/java"
to work, or that may work by itself...