I have a somewhat random and very environment specific question but hoping I’m just missing something obvious.. I’m wondering how to make emacs automatically/always aware of $JAVA_HOME.. I use jabba to manage JVMs, and $JAVA_HOME is set by default in any new terminal I run, but emacs (spacemacs) is unable to locate a Java runtime by default, until I set it manually
this is helpful, thank you!
The Jabba readme says it changes the RC file of the shell. So I assume it sets JAVA_HOME to a specific install of Java.
Running Emacs command from the terminal should pick up the JAVA_HOME environment variable.
However, if running Emacs from a desktop launcher (dock/menu), then I assume the .profile file for your OS account must source the RC file, e.g ~/.bashrc
If JAVA_HOME is changed when Emacs is running, then try reloading environment variables using SPC f e E
Note that any running Clojure REPL will need to be restarted (stop/start) to pick up changed environment variables
I’ve always used jenv. You can set a local jvm version per directory with a .java-verison file. Emacs (as well as other editors) seems to respect it.