This page is not created by, affiliated with, or supported by Slack Technologies, Inc.
2023-04-28
Channels
- # aleph (3)
- # announcements (3)
- # babashka (8)
- # beginners (12)
- # biff (4)
- # calva (12)
- # clerk (29)
- # clj-kondo (1)
- # clojure (104)
- # clojure-art (1)
- # clojure-austin (5)
- # clojure-berlin (3)
- # clojure-brasil (34)
- # clojure-europe (11)
- # clojure-germany (16)
- # clojure-losangeles (9)
- # clojure-nl (30)
- # clojure-norway (58)
- # clojure-uk (1)
- # core-async (8)
- # cursive (4)
- # data-science (9)
- # datalevin (1)
- # datomic (40)
- # emacs (2)
- # events (3)
- # helix (1)
- # honeysql (3)
- # hugsql (1)
- # hyperfiddle (66)
- # jobs (4)
- # juxt (7)
- # kaocha (9)
- # lsp (5)
- # malli (10)
- # off-topic (4)
- # polylith (2)
- # reitit (5)
- # releases (1)
- # remote-jobs (5)
- # sci (46)
- # scittle (2)
- # shadow-cljs (9)
- # tools-deps (17)
- # xtdb (8)
I'm probably blind but I can't find a way to specify the java
binary path, preferably on a per-project basis.
Got back to trying Calva with one of my projects and the Getting Started REPL doesn't work because it tries to use JDK that I no longer have. I have no clue where it could possibly be specified. It's not in the settings, not in the project's files, not in the environment variables.
Getting this:
⚡️ Starting the REPL ⚡️ using the below command line:
pushd /tmp/betterthantomorrow.calva/1bbwhb ; java -jar '/home/p-himik/.vscode/extensions/betterthantomorrow.calva-2.0.353/deps.clj.jar' -Sdeps '{:deps {nrepl/nrepl {:mvn/version,"1.0.0"},cider/cider-nrepl {:mvn/version,"0.28.5"}}}' -M -m nrepl.cmdline --middleware "[cider.nrepl/cider-middleware]" ; popd
Exception in thread "main" java.io.IOException: Cannot run program "/home/p-himik/soft/adopt-open-jdk-11.0.12+7/bin/java": error=2, No such file or directory
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1143)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1073)
at borkdude.deps$shell_command.invokeStatic(deps.clj:103)
at borkdude.deps$_main.invokeStatic(deps.clj:797)
at borkdude.deps$_main.doInvoke(deps.clj:589)
at clojure.lang.RestFn.applyTo(RestFn.java:137)
at borkdude.deps.main(Unknown Source)
Caused by: java.io.IOException: error=2, No such file or directory
at java.base/java.lang.ProcessImpl.forkAndExec(Native Method)
at java.base/java.lang.ProcessImpl.<init>(ProcessImpl.java:315)
at java.base/java.lang.ProcessImpl.start(ProcessImpl.java:245)
at java.base/java.lang.ProcessBuilder.start(ProcessBuilder.java:1110)
... 6 more
Jack-in process exited. Status: 1
Tried both ways of starting that REPL - with and without reusing the existing temp directory. Same outcome.
Sometimes VS Code gets started with a weird environment. You can try open it from a terminal which has an environment you recognize, using the code
command. There is also a setting calva.jackInEnv
, where you could specify JAVA_HOME
, if all else fails.
Same outcome.
And the stacktrace above suggests that java
was found. But it then tried to launch another java
subprocess, for some reason with a completely different JDK specified who knows where. :)
Thanks!
But a part of the question is still open - is there a way to specify JDK on a per-project basis? Without having to start VSCode in the right environment.
I prefer to start it from the menu of my window manager and then use VSCode's built-in UI to open the right project instead of opening a terminal, navigating to the right project, and then starting code
there.
I just start VS Code from a terminal, without regard to wether it is the right project root or not. If calva.jackInEnv
worked for specifying Java version (a bit unclear to me if it did) you can use it in Workspace settings. You can also copy the jack-in command line (there’s a command for this) and start it from a terminal, and then connect Calva to the REPL. The copied command line will contain a step for changing the directory to the project root, so you don’t need to cd there first.