[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: java anyone?
From: |
Jean-Christophe Helary |
Subject: |
Re: java anyone? |
Date: |
Mon, 19 Jul 2021 07:17:59 +0900 |
Thank you Pankaj. I'll give that a try.
Jean-Christophe
> On Jul 18, 2021, at 20:26, Pankaj Jangid <pankaj@codeisgreat.org> wrote:
>
> Jean-Christophe Helary <lists@traduction-libre.org> writes:
>
>> I need something where I can just lookup functions in a code base with
>> a local javadoc tree, including online Oracle documentation, etc. Not
>> a full-fledged IDE with completion.
>
> I use a very lightweight language server facilitator, named Eglot. There
> are a couple of settings that are required for this to work. This is the
> minimal set that I came-up with after discussing in and following the
> Eglot tracker.
>
> 1. Tell Emacs the value of JAVA_HOME. ‘(setenv "JAVA_HOME" ...)’
>
> 2. By default, Eglot uses, Eclipse JDT Language server so you need to
> install it somewhere. I simply pulled the git repository at
> ~/.emacs.d/eclipse.jdt.ls. After building the Eclipse JDT LS (‘mvn
> clean; mvn package’), you must add the language server JAR to the
> CLASSPATH. I use the following snippet:
>
> --8<---------------cut here---------------start------------->8---
> (defun add-to-classpath (item)
> "Add ITEM to CLASSPATH."
>
> (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 ":"))))
>
> (add-to-classpath
> (substring
> (shell-command-to-string
> (format
> "find %s -name 'org.eclipse.equinox.launcher_*jar'"
> (expand-file-name
> "eclipse.jdt.ls/org.eclipse.jdt.ls.product/target/repository/plugins"
> user-emacs-directory)))
> 0 -1))
> --8<---------------cut here---------------end--------------->8---
>
> Eglot works with project.el, xref.el, eldoc.el etc. So many usual things
> will work out of the box. Like online help when the point is inside a
> function name.
>
> It also works with company; but that is not required.
>
>
--
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/