---
title: "Neovim and LazyVim for Java: Installing the Editor, a JDK and the Starter"
canonical: "https://mnafshin.info/devtools/01-installing-neovim-lazyvim-and-a-jdk/"
author: "Afshin Amini"
date: 2026-11-29
---
# Neovim and LazyVim for Java: Installing the Editor, a JDK and the Starter

Neovim is a text editor that runs in a terminal. It does not know Java by itself, but it speaks the Language Server Protocol, so a separate Java server can give it completion, navigation and error checking. LazyVim is a ready-made Neovim configuration. It installs and wires together the plugins an IDE needs, and lets you switch on language support one "extra" at a time.

## What each piece does

Four pieces work together.

- **Neovim** is the editor.
- **lazy.nvim** is a plugin manager. It downloads plugins and loads each one only when it is needed.
- **LazyVim** is a configuration built on lazy.nvim. It brings sensible defaults, key bindings and optional **extras**: small bundles that set up one language or one feature.
- **Mason** is a plugin that downloads external tools, such as the Java language server and the Java debugger, into Neovim's own data folder.

The Java extra connects them: it asks Mason for the Java language server and starts it whenever you open a `.java` file.

## Tools to install first

LazyVim lists its requirements on its home page. On the date of this series they are:

- Neovim 0.11.2 or newer, built with LuaJIT. The Spring Boot plugin in Part 4 needs Neovim 0.12, so install 0.12 or newer.
- Git 2.19 or newer.
- `tree-sitter-cli` and a C compiler. LazyVim uses them to build syntax parsers.
- `curl`, used by the completion engine.
- `ripgrep` and `fd` for searching text and file names. A Nerd Font is optional and only adds icons.
- A terminal with true colour, such as kitty, WezTerm or Ghostty.

Java needs one more thing: a JDK. The Java language server itself runs on Java 21 or newer. Our example project, the SpringUniverse companion code, uses Spring Boot 4.1.2 with Java 25, so a JDK 25 covers both. The project ships the Maven Wrapper, `./mvnw`, which downloads the right Maven version for you, so no separate Maven install is needed.

Check the versions before going on:

```sh
nvim --version
java -version
```

## Optional: install and switch JDKs with SDKMAN

Skip this section if you already have a JDK 25 from your package manager. SDKMAN is a command-line tool for macOS, Linux and Windows under WSL that installs several JDKs side by side and switches between them. It needs `bash`, `curl`, `zip` and `unzip`:

```sh
curl -s "https://get.sdkman.io" | bash
source "$HOME/.sdkman/bin/sdkman-init.sh"
sdk list java                      # find the exact identifier
sdk install java 25.0.5.1+2-tem    # Temurin 25; asks to make it the default
```

The identifier changes with every patch release, so copy it from your own list. `sdk use java <id>` switches only the current shell, `sdk default java <id>` changes every new shell, and `sdk env init` writes a `.sdkmanrc` file that pins a project to one JDK; `sdk env` applies it.

SDKMAN sets `JAVA_HOME` in your shell, and Neovim passes it on to the Java language server, so start `nvim` from a shell where the right JDK is active. On our test machine, switching from Temurin 25 to JDK 21 and back worked.

## Install the LazyVim starter

The rest of this series builds the setup this way, one extra at a time, so you can see what each piece does. If you would rather clone a configuration that already contains everything the series tested, Part 15 has that repository.

The starter is a small Git repository with the folder layout LazyVim expects. If you already have a Neovim configuration, move it away first, then clone the starter and remove its Git history so it becomes your own:

```sh
mv ~/.config/nvim{,.bak}
git clone https://github.com/LazyVim/starter ~/.config/nvim
rm -rf ~/.config/nvim/.git
nvim
```

On the first start, lazy.nvim installs every plugin and LazyVim builds its syntax parsers. When it is done, run `:LazyHealth`. It loads all plugins and reports anything that is missing, such as a tool from the list above.

The [Installation page](https://www.lazyvim.org/installation) also covers Windows.

## Switch on the Java and debugger extras

Open the extras screen with `:LazyExtras`. Move to `lang.java` and press `x` to enable it, then do the same for `dap.core`. The first sets up the Java language server, the second the debugger. Restart Neovim afterwards.

LazyVim remembers your choice in a small file next to your configuration:

```json
{
  "extras": [
    "lazyvim.plugins.extras.dap.core",
    "lazyvim.plugins.extras.lang.java"
  ]
}
```

Keep `lazyvim.json` in Git with the rest of your configuration, so the same extras come back on every machine.

After the restart, Mason downloads `jdtls` (the Java language server), `java-debug-adapter` and `java-test` in the background. `:Mason` shows their progress. Wait until all three are installed, then restart once more so the language server starts cleanly.

## Open the example project

Clone the companion code and start Neovim from the repository root, opening the catalog controller of module 9:

```sh
git clone https://github.com/mnafshin/springuniverse-code
cd springuniverse-code
nvim module-09-catalog/src/main/java/info/mnafshin/springuniverse/shop/CatalogController.java
```

[CatalogController.java](https://github.com/mnafshin/springuniverse-code/blob/main/module-09-catalog/src/main/java/info/mnafshin/springuniverse/shop/CatalogController.java)

The language server looks upward for a project root. It finds `mvnw` at the top of the repository and imports the whole Maven build, one module after another. On our test machine the first import of all 27 modules took under a minute; later starts reuse the workspace that jdtls caches under `~/.cache/nvim/jdtls/`. When the status line settles, Java support is active: hovering, jumping to definitions and live error checking all work, and Part 2 explains them.

## Recap

- Neovim is the editor, lazy.nvim manages plugins, LazyVim configures them, and Mason downloads external tools.
- Install Neovim 0.12 or newer, Git, `tree-sitter-cli`, a C compiler, `curl`, `ripgrep`, `fd` and a JDK of version 21 or newer; the example project needs JDK 25. SDKMAN is an optional way to install and switch JDKs.
- Clone the LazyVim starter into `~/.config/nvim`, remove its `.git` folder and run `:LazyHealth`.
- Enable `lang.java` and `dap.core` in `:LazyExtras`, then let Mason install `jdtls`, `java-debug-adapter` and `java-test`.
- Start Neovim from the project root so the whole Maven build is imported.

**Series: Neovim as a Java IDE.** Next: [Java language support in Neovim with jdtls](/devtools/02-java-language-support-with-jdtls/)

## Sources

Official documentation and well-known tutorials read while writing this article. The wording here is our own.

- [LazyVim: Getting Started and requirements](https://www.lazyvim.org/)
- [LazyVim: Installation](https://www.lazyvim.org/installation)
- [LazyVim: Java extra](https://www.lazyvim.org/extras/lang/java)
- [LazyVim: dap.core extra](https://www.lazyvim.org/extras/dap/core)
- [Neovim releases](https://github.com/neovim/neovim/releases)
- [SDKMAN: Installation](https://sdkman.io/install)
- [SDKMAN: Usage](https://sdkman.io/usage)
- [mason.nvim README](https://github.com/mason-org/mason.nvim)
- [nvim-jdtls README](https://github.com/mfussenegger/nvim-jdtls)
- [Lorenzo Bettini: Neovim and Java with LazyVim, part 1: initial configuration](https://www.lorenzobettini.it/2024/11/neovim-and-java-with-lazyvim-part-1-initial-configuration/)
- [Nirmal Ravidas: Setting Up a Full Spring Boot Dev Environment on Linux with Neovim and LazyVim](https://nirmalravidas.hashnode.dev/spring-boot-dev-environment-linux-neovim-lazyvim)
- [Trinity Logic: A Terminal-First Java and Maven Setup — Neovim, jdtls and the Build Loop](https://www.trinitylogic.co.uk/blog/terminal-first-java-maven-neovim-jdtls/)
