calva icon indicating copy to clipboard operation
calva copied to clipboard

clojure-lsp throws an error when Java is not found

Open mattiasthalen opened this issue 10 months ago • 2 comments

I'm running a devcontainer with the image babashka/babashka, and it spits out the following error. It can be solved by adding java to the devcontainer.

It might not be related to Calva at all, if so, I'm sorry!

LSP classpath lookup failed when running `/usr/local/bin/bb print-deps --format classpath`. Some features may not work properly if ignored.

Error: Exception in thread "main" java.lang.Exception: Couldn't find 'java'. Please set JAVA_HOME.
	at borkdude.deps$get_java_cmd.invokeStatic(deps.clj:283)
	at borkdude.deps$_main.invokeStatic(deps.clj:931)
	at borkdude.deps$_main.doInvoke(deps.clj:911)
	at clojure.lang.RestFn.applyTo(RestFn.java:140)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at babashka.deps$clojure.invokeStatic(deps.clj:40)
	at babashka.impl.print_deps$print_deps$fn__29495.invoke(print_deps.clj:41)
	at babashka.impl.print_deps$print_deps.invokeStatic(print_deps.clj:41)
	at babashka.main$exec$fn__33265.invoke(main.clj:1034)
	at clojure.lang.AFn.applyToHelper(AFn.java:152)
	at clojure.lang.AFn.applyTo(AFn.java:144)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at clojure.core$with_bindings_STAR_.invokeStatic(core.clj:1990)
	at clojure.core$with_bindings_STAR_.doInvoke(core.clj:1990)
	at clojure.lang.RestFn.invoke(RestFn.java:428)
	at babashka.main$exec.invokeStatic(main.clj:837)
	at babashka.main$main.invokeStatic(main.clj:1229)
	at babashka.main$main.doInvoke(main.clj:1173)
	at clojure.lang.RestFn.applyTo(RestFn.java:140)
	at clojure.core$apply.invokeStatic(core.clj:667)
	at babashka.main$_main.invokeStatic(main.clj:1261)
	at babashka.main$_main.doInvoke(main.clj:1253)
	at clojure.lang.RestFn.applyTo(RestFn.java:140)
	at babashka.main.main(Unknown Source)
	at java.base@24/java.lang.invoke.LambdaForm$DMH/sa346b79c.invokeStaticInit(LambdaForm$DMH)

mattiasthalen avatar May 05 '25 09:05 mattiasthalen

@PEZ, I logged the issue here, instead of polluting the Slack channel

mattiasthalen avatar May 05 '25 09:05 mattiasthalen

It's related to Calva. It's clojure-lsp that can't determine the classpath when Java isn't available. Without knowledge about the classpath clojure-lsp can't help as much as it otherwise can. You can safely ignore this, as long as you are fine with less help from Calva and clojure-lsp.

It could be reported more gracefully.

PEZ avatar May 05 '25 10:05 PEZ