unofficial mirror of help-gnu-emacs@gnu.org
 help / color / mirror / Atom feed
* java anyone?
@ 2021-07-17 22:34 Jean-Christophe Helary
  2021-07-17 22:42 ` Dmitry Gutov
  2021-07-18 11:26 ` Pankaj Jangid
  0 siblings, 2 replies; 5+ messages in thread
From: Jean-Christophe Helary @ 2021-07-17 22:34 UTC (permalink / raw)
  To: Help Gnu Emacs mailing list

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 tried to install jdee yesterday but when I try to run it I have a weir error message, so I dumped it. The I tried jmt and here again I had weird error messages.

So I'm left with:

  java-class-doc
  java-complete 
  java-snippets 
  javadoc-lookup
  lsp-java       
  lsp-javacomp   

available from package.el.

I'm currently running java-mode, which seems to be a derivative of cc-mode, and I guess I'm fine with that, but I'm not sure what's the best combination with the above packages.

Is there anybody who has some experience with java packages here and can enlighten me?

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: java anyone?
  2021-07-17 22:34 java anyone? Jean-Christophe Helary
@ 2021-07-17 22:42 ` Dmitry Gutov
  2021-07-18  2:32   ` Jean-Christophe Helary
  2021-07-18 11:26 ` Pankaj Jangid
  1 sibling, 1 reply; 5+ messages in thread
From: Dmitry Gutov @ 2021-07-17 22:42 UTC (permalink / raw)
  To: Jean-Christophe Helary, Help Gnu Emacs mailing list

On 18.07.2021 01:34, Jean-Christophe Helary wrote:
> I'm currently running java-mode, which seems to be a derivative of cc-mode, and I guess I'm fine with that, but I'm not sure what's the best combination with the above packages.
> 
> Is there anybody who has some experience with java packages here and can enlighten me?

lsp-java is probably the best option these days.

I won't help with particular settings (haven't touched any Java for 
years), but here is a relevant question with answers: 
https://emacs.stackexchange.com/questions/47933/are-there-any-tutorials-documentation-for-lsp-java



^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: java anyone?
  2021-07-17 22:42 ` Dmitry Gutov
@ 2021-07-18  2:32   ` Jean-Christophe Helary
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe Helary @ 2021-07-18  2:32 UTC (permalink / raw)
  To: Dmitry Gutov; +Cc: Help Gnu Emacs mailing list



> On Jul 18, 2021, at 7:42, Dmitry Gutov <dgutov@yandex.ru> wrote:
> 
> On 18.07.2021 01:34, Jean-Christophe Helary wrote:
>> I'm currently running java-mode, which seems to be a derivative of cc-mode, and I guess I'm fine with that, but I'm not sure what's the best combination with the above packages.
>> Is there anybody who has some experience with java packages here and can enlighten me?
> 
> lsp-java is probably the best option these days.
> 
> I won't help with particular settings (haven't touched any Java for years), but here is a relevant question with answers: https://emacs.stackexchange.com/questions/47933/are-there-any-tutorials-documentation-for-lsp-java

Thank you Dmitri.

I've also found the meghanada package which seems to allow for navigation between files.

-- 
Jean-Christophe Helary @brandelune
https://mac4translators.blogspot.com
https://sr.ht/~brandelune/omegat-as-a-book/




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: java anyone?
  2021-07-17 22:34 java anyone? Jean-Christophe Helary
  2021-07-17 22:42 ` Dmitry Gutov
@ 2021-07-18 11:26 ` Pankaj Jangid
  2021-07-18 22:17   ` Jean-Christophe Helary
  1 sibling, 1 reply; 5+ messages in thread
From: Pankaj Jangid @ 2021-07-18 11:26 UTC (permalink / raw)
  To: help-gnu-emacs

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.




^ permalink raw reply	[flat|nested] 5+ messages in thread

* Re: java anyone?
  2021-07-18 11:26 ` Pankaj Jangid
@ 2021-07-18 22:17   ` Jean-Christophe Helary
  0 siblings, 0 replies; 5+ messages in thread
From: Jean-Christophe Helary @ 2021-07-18 22:17 UTC (permalink / raw)
  To: Pankaj Jangid; +Cc: help-gnu-emacs

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/




^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2021-07-18 22:17 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2021-07-17 22:34 java anyone? Jean-Christophe Helary
2021-07-17 22:42 ` Dmitry Gutov
2021-07-18  2:32   ` Jean-Christophe Helary
2021-07-18 11:26 ` Pankaj Jangid
2021-07-18 22:17   ` Jean-Christophe Helary

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).