[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Editing Java (with LSP)

From: Pankaj Jangid
Subject: Re: Editing Java (with LSP)
Date: Thu, 16 Jun 2022 08:59:19 +0530
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/29.0.50 (gnu/linux)

Alessandro Bertulli
<> writes:

> Can you please give me your feedback? Does any of you write Java code?
> How is it? Do you have the same problems too? If yes, have you found a
> solution? Do you use LSP? Or some other package?

I use There is a bit of struggle in setting this

Although, eglot tries to download latest but it is not
always perfect. There are CLASSPATH issues and all those things which
are typical of Java. And even after full setup I face issues here and
there. Sometimes.

My setup is like this (assuming you have cloned
repository inside ~/.emacs.d and built using ‘./mvnw clean package’),

--8<---------------cut here---------------start------------->8---
(unless (package-installed-p 'eglot)
  (package-install 'eglot))
 '(eglot-connect-timeout nil))
(declare-function eglot-ensure "eglot")
(add-hook 'java-mode-hook
                  #'eglot-ensure)                               ;

(defun my/add-to-classpath (item)
  (let ((class-path (getenv "CLASSPATH")))
    (defvar class-path-list (if class-path
                                (split-string class-path ":")))
    (cl-pushnew item class-path-list)
    (setenv "CLASSPATH"
            (mapconcat 'identity class-path-list ":"))))

(when (file-exists-p (expand-file-name "" user-emacs-directory))
      "find %s -name 'org.eclipse.equinox.launcher_*jar'"
    0 -1)))
--8<---------------cut here---------------end--------------->8---

Also I use ‘exec-path-from-shell’ package to setup PATHs in GUI Emacs.


reply via email to

[Prev in Thread] Current Thread [Next in Thread]