Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

JAVA_HOME, asdf and jdtls #381

Closed
Cletip opened this issue Mar 11, 2022 · 3 comments
Closed

JAVA_HOME, asdf and jdtls #381

Cletip opened this issue Mar 11, 2022 · 3 comments

Comments

@Cletip
Copy link

Cletip commented Mar 11, 2022

Hello,

I am with ubuntu and I have installed, with asdf, openjdk version "16.0.2" 2021-07-20.

Moreover, when I do the command
echo $JAVA_HOME
I have the following result:
/home/user/.dotfiles/.asdf/installs/java/openjdk-16.0.2
Which is for me quite normal.

Moreover, I can compile and launch a java program.

However, when I try to install jdtls with the following command: lsp-install-server jdtls, I get this error:
JAVA_HOME is not defined correctly.

Complete error: 
sh mvnw -Djdt.js.server.root=/home/user/.dotfiles/.emacs.d/var/lsp-java/eclipse.jdt.ls/server/ -Djunit.runner. root=/home/user/.dotfiles/.emacs.d/var/lsp-java/eclipse.jdt.ls/test-runner/ -Djunit.runner.fileName=junit-platform-console-standalone. jar -Djava.debug.root=/home/user/.dotfiles/.emacs.d/var/lsp-java/eclipse.jdt.ls/server/bundles clean package -Djdt.download.url=https://download.eclipse.org/jdtls/milestones/1.5.0/jdt-language-server-1.5.0-202110191539.tar.gz
Error: JAVA_HOME is not defined correctly.
We cannot execute

Thanks in advance for your future answers

@yyoncho
Copy link
Member

yyoncho commented Mar 11, 2022

@Cletip Cletip closed this as completed Mar 11, 2022
@Cletip
Copy link
Author

Cletip commented Mar 11, 2022

That's works perfectly ! Thanks you a lot, really ! I post the solution here :

(use-package exec-path-from-shell
:config
(exec-path-from-shell-initialize)
)

@max-nazarati
Copy link

Had the same issue on MacOS with zsh and homebrew-installed Emacs. What worked for me is moving the export JAVA_HOME... to the ~/.zshenv file instead of the ~/.zshrc. Apparently the latter one is intended for configuring an interactive shell and Emacs does not make use of it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants