Files
doomemacs/modules/lang/java
Henrik Lissner fc7b179e6c bump: :lang
Wilfred/helpful@5ad8a9ce57 -> Wilfred/helpful@6a4d5e0760
agda/agda@10a0ca0516 -> agda/agda@49a12eab7f
clojure-emacs/cider@a0d6169026 -> clojure-emacs/cider@fdfa7c2200
dominikh/go-mode.el@602d73e226 -> dominikh/go-mode.el@0ed3c5227e
emacs-geiser/gauche@8ff743f641 -> emacs-geiser/gauche@9eb8b35f0c
emacs-lsp/lsp-dart@7e3d342941 -> emacs-lsp/lsp-dart@2170823139
emacs-lsp/lsp-java@868600bf7f -> emacs-lsp/lsp-java@6cfff8761e
emacs-lsp/lsp-metals@567089f7f4 -> emacs-lsp/lsp-metals@345b4fa80e
emacs-lsp/lsp-sourcekit@63ff1ab638 -> emacs-lsp/lsp-sourcekit@3bd9750e7e
emacs-lsp/lsp-treemacs@fb1a07ae0a -> emacs-lsp/lsp-treemacs@312dee2b3a
emacs-rustic/rustic@fbbf0a7192 -> emacs-rustic/rustic@22a5ef8bfd
emacs-straight/auctex@53f80ba36c -> emacs-straight/auctex@6fb366064c
emacs-straight/csv-mode@6979fc18eb -> emacs-straight/csv-mode@1695ee1752
emacsorphanage/dart-mode@88b6683f43 -> emacsorphanage/dart-mode@6229941ec5
erlang/otp@64185e73b0 -> erlang/otp@740af6bae5
fsharp/emacs-fsharp-mode@677d78c4d6 -> fsharp/emacs-fsharp-mode@bf7a11e1ba
gcv/julia-snail@24f79a067b -> gcv/julia-snail@cacf52e4c8
godotengine/emacs-gdscript-mode@c3d9988984 -> godotengine/emacs-gdscript-mode@3f3739dd88
greghendershott/racket-mode@eef5e9ab2c -> greghendershott/racket-mode@88d82e249e
jrblevin/markdown-mode@ee9d6de1d2 -> jrblevin/markdown-mode@d2d960bec1
json-emacs/json-mode@77125b01c0 -> json-emacs/json-mode@466d5b5637
ledger/ledger-mode@356d8049ed -> ledger/ledger-mode@d9b6648201
rust-lang/rust-mode@542f1755d8 -> rust-lang/rust-mode@efd830806c
seagle0128/grip-mode@ffce7f78eb -> seagle0128/grip-mode@e90e3b47d8
ziglang/zig-mode@f0b4a48753 -> ziglang/zig-mode@4ad4edf759
2025-04-01 03:49:02 -04:00
..
2024-09-14 20:47:39 -04:00
2024-10-20 02:41:50 -04:00
2025-04-01 03:49:02 -04:00

:lang java

Description   unfold

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

Maintainers

This module has no dedicated maintainers. Become a maintainer?

Module flags

+lsp
Enable LSP support for java-mode. Requires doom-module::tools lsp and a langserver (supports eclipse.jdt.ls). Incompatible with doom-module:+meghanada.
+meghanada
Enable doom-package:meghanada-mode. Incompatible with doom-module:+lsp.
+tree-sitter
Leverages tree-sitter for better syntax highlighting and structural text editing. Requires doom-module::tools tree-sitter.

Hacks

No hacks documented for this module.

TODO Changelog

This module does not have a changelog yet.

Installation

Enable this module in your doom! block.

This module requires:

OpenJDK 11

Ubuntu

#+begin-src sh apt-get install openjdk-11-jdk-headless

#+end_src

Fedora

dnf install java-11-openjdk

Oracle JDK 11

Ubuntu

add-apt-repository ppa:linuxuprising/java
apt update
apt install oracle-java11-installer
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 it:

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

Multiple Java Versions

It is common to need support for multiple Java versions. You can use a generic tool like jabba to install and manage multiple Java versions on any OS.

To have a different version of Java per-project, it is recommended you use direnv and doom-module::tools direnv; create a .envrc in the root of the project pointing to the Java installation:

PATH_add ~/.jabba/jdk/adopt@1.11.0-3
JAVA_HOME=~/.jabba/jdk/adopt@1.11.0-3

And then run $ direnv allow . in the project directory. The doom-module::tools direnv module will automatically source this environment before activating LSP servers.

Formatter

doom-module::editor format uses google-java-format to handle formatting.

To install, grab the latest all-deps.jar release from the above, put it somewhere and create a script similar to the below:

/usr/local/bin/google-java-format

java -jar /path/to/google-java-format-all-deps.jar

TODO Usage

󱌣 This module's usage documentation is incomplete. Complete it?

doom-module:+lsp features

According to https://github.com/emacs-lsp/lsp-java, you get:

+meghanada features

According to https://github.com/mopemope/meghanada-emacs/, you get:

TODO Configuration

󱌣 This module's configuration documentation is incomplete. Complete it?

doom-module:+lsp

Install the eclipse server by executing M-x lsp-install-server and selecting jdtls. After that any newly opened java files should start the LSP server automatically.

To update the server, perform SPC u M-x lsp-install-server.

Note that if you change Java version you may need to remove the LSP server and install it again. You can do this with M-x +lsp/uninstall-server followed by M-x lsp-install-server.

Enable the doom-module::tools debugger +lsp module to get test runner support.

Troubleshooting

There are no known problems with this module. Report one?

Frequently asked questions

This module has no FAQs yet. Ask one?

TODO Appendix

󱌣 This module has no appendix yet. Write one?