technomancy / leiningen

Moved to Codeberg; this is a convenience mirror

Home Page:https://codeberg.org/leiningen/leiningen

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java installed by sdkman not being recognized on emacs+cider runs

victorpigmeo opened this issue · comments

Hey folks, don't know if this a bug request, nor if this is the right repo to report this, I got this problem:
It is a fresh machine with debian 12.
I installed Emacs (with doom framework).
I installed Java with SDKMAN.
I downloaded the lein script from the official site, and I put it on my home bin directory.
I use clojure-lsp on my project.
When I run lein from the command line, for example, lein test everything runs fine, but when I try to run it from emacs, it says it can't find the JAVA_CMD variable nor the java executable on my path, is this a lein problem? or should I create an issue on cider or doom-emacs? 🤔

I did try to export that variable, but it seems that it only ignore it, I had it on my .zshrc file, but still didn't work.

I'm just curious cause it looks like lein ran on emacs(cider), but fails right away with that error, that is why I'm posting here first.

For anyone having the same issue, creating a simbolic link from the sdkman executable to /usr/bin or any other "bin" directory will fix the issue 😃

Hi,
this is most probably a disconnect between your shell (where SDKMAN apparently puts the path to java) and emacs. Unfortunately can't help you with that one, but there should be some docs how to get emacs to know env vars (or read PATH from the shell on startup), and as you said JAVA_CMD should be sufficient.

Yeah, hard to know more without knowing your emacs config but it's really common to set your path in a shell-specific config file and then launch emacs from something other than your shell. You'll need to configure your path consistently so that all programs can see it, not just ones that have the shell as an ancestor. Without knowing how you launch emacs it's hard to give more specifics about how this would be done, but it's not really related to leiningen so I'll close this on out.