Skip to content

Latest commit

 

History

History
50 lines (36 loc) · 3.62 KB

File metadata and controls

50 lines (36 loc) · 3.62 KB

README

Overview

This package provides additional Java programming language support for eglot.

  • Few convenience functions are available for common operations such as creating a new project or class.
  • The Eclipse JDT Language Server is automatically installed (if needed) when you open a Java file: this gives you code completion, refactoring capabilities, etc.
FunctionDescription
eglot-java-project-newCreate new projects with a wizard (spring, Maven or Gradle projects)
eglot-java-project-build-refreshRebuild the current project
eglot-java-project-build-taskRun a build task using Gradle or Maven for the current project
eglot-java-file-newWizard for creating new Java files
eglot-java-run-mainRun the current main class
eglot-java-run-testRun the current test (JUnit only, unless you run Maven or Gradle tasks)

Dependencies

  • The only direct Emacs package dependency is eglot, assuming you’re running a recent Emacs version.
  • The Eclipse JDT Language server along with the JUnit console runner are configured to be automatically installed when not found at default locations (see M-x customize-group eglot-java).
    • The Eclipse JDT.LS team mentions that there’s support for compiling projects from Java 1.5 through 16, but you’re encouraged to use recent versions of the Java Development Toolkit (JDK).
    • This extension has been tested with recent Java and Eclipse JDT snapshot versions for few years (since roughly mid-2018).
  • Please also configure your PATH environment variable for Maven and/or for Gradle.

Installation

Copy the contents of eglot-java.el to a new Emacs buffer and run the command M-x package-install-from-buffer.

Usage

Customization

You can configure few settings to reflect your preferences via M-x customize-group (eglot-java): LSP server installation folder, etc.

  • The default java-mode keybindings are controlled by the custom variable eglot-java-default-bindings-enabled.
  • The default prefix key for available functions is defined by the variable eglot-java-prefix-key (C-c l).

Configuration

Please find below a simple initialization of this package.

(eval-after-load 'eglot-java
  (progn
    (require 'eglot-java)
    '(eglot-java-init)))