technomancy / leiningen

Moved to Codeberg; this is a convenience mirror
https://codeberg.org/leiningen/leiningen
Other
7.29k stars 1.61k forks source link

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

Closed victorpigmeo closed 1 week ago

victorpigmeo commented 1 week ago

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 😃

winks commented 1 week ago

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.

technomancy commented 1 week ago

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.