doomemacs/modules/lang/java
2020-05-06 07:47:04 +01:00
..
+eclim.el Refactor localleader keybinds #1270 2019-10-04 22:04:47 -04:00
+lsp.el Fix lsp-jt-root in case someone wants to experiment with java-test 2020-05-06 07:47:04 +01:00
+meghanada.el Fix references to :tools fly{spell,check} 2020-01-14 03:04:26 -05:00
autoload.el 💥 Refactor add-hook! macro & change arg order 2019-07-26 20:17:29 +02:00
config.el General refactors, reformatting & comment revision 2020-04-23 23:56:17 -04:00
doctor.el Add :tools lsp checks for +lsp flag 2019-04-24 18:16:05 -04:00
packages.el Bump :lang 2020-03-27 16:57:56 -04:00
README.org First draft for java documentation (#2713) 2020-04-29 00:05:13 -04:00

lang/java

Description

This module adds java support to Doom Emacs, including android-mode and groovy-mode.

Module Flags

  • +lsp Enables integration for the eclipse.jdt.ls LSP server.
  • +meghanada Enables the meghanada-mode

The +lsp and +meghanada packages are mutually exclusive and do not work together. At the time of writing the +meghanada is already configured whereas +lsp needs to manual configuring.

Prerequisites

This module requires the Java SDK.

OpenJDK 11

Ubuntu

sudo apt-get install openjdk-11-jdk-headless

Fedora

sudo dnf install java-11-openjdk

Oracle JDK 11

Ubuntu

sudo add-apt-repository ppa:linuxuprising/java
sudo apt update
sudo apt install oracle-java11-installer
sudo apt install oracle-java11-set-default

Fedora

curl -O https://download.java.net/java/GA/jdk11/9/GPL/openjdk-11.0.2_linux-x64_bin.tar.gz
tar zxvf openjdk-11.0.2_linux-x64_bin.tar.gz
sudo mv jdk-11.0.2/ /usr/local/

Open /etc/profile.d/jdk11.sh as root and add

export JAVA_HOME=/usr/local/jdk-11.0.2
export PATH=$PATH:$JAVA_HOME/bin

Save the file and source the file

source /etc/profile.d/jdk11.sh
java -version

Features

+lsp features

According to https://github.com/emacs-lsp/lsp-java it adds

  • As you type reporting of parsing and compilation errors (via flycheck/lsp-ui)
  • Code completion - using company-lsp or builtin complete-at-point
  • Javadoc hovers - using lsp-ui
  • Code actions - using lsp-ui
  • Code outline - using builtin imenu
  • Code navigation - using builtin xref
  • Code lens (references/implementations) - using builtin xref
  • Highlights
  • Code formatting
  • Maven pom.xml project support
  • Limited Gradle support
  • Visual debugger - dap-mode
  • Test runner - dap-mode
  • Project explorer integration - treemacs
  • Integration with Spring Initializr

+meghanada features

According to https://github.com/mopemope/meghanada-emacs/ it adds

  • Auto-update server module
  • Gradle and Maven and Eclipse project support
  • No need build tool's plugin
  • Run build tool task
  • Compile your project
  • Syntax check and analyze java source (flycheck-meghanada)
  • Support Generic Types
  • Code completion with company-mode (company-meghanada)
  • Optimize import and sort
  • Jump declaration
  • Run JUnit test (include test runner)
  • Diagnostic reporting with flycheck (flycheck-meghanada)
  • Show symbol's type info with el-doc
  • Search references
  • Full-featured text search

TODO Configuration