Neovim for Beginners — Java

Use Neovim for Java application development.

4 min readMay 28, 2022


Neovim for Beginners — Java

We have already configured Neovim for languages like Python, JavaScript, TypeScript, Rust, Go, Lua, HTML, etc. In this article, let’s check out how we can use Neovim for Java application development.

This article is part of the Neovim for Beginners series.

The Neovim configuration files can be found in this repository.

Getting Started

Java Development Kit (JDK)

Depending on the operating system, we need to install OpenJDK or Oracle JDK.

Language Server

For the language server, we can use the language server is easy by using nvim-lsp-installer.

Type the command :LspInstall jdtls to install the language server. Alternatively, type the command :LspInstallInfo, select jdtls and press i to install.

Install Language Server

The installation folder can be found under the standard path location.

local JDTLS_LOCATION = vim.fn.stdpath "data" .. "/lsp_servers/jdtls"

We will use this trick later to avoid hard-coding the location.


Let’s get started with the configuration.

Plugin — nvim-jdtls

In the lua/plugins.lua file, add the following lines to install the nvim-jdtls plugin using packer.nvim.

use { "mfussenegger/nvim-jdtls", ft = { "java" }

File Type Plugin

Create the Java file type plugin after/ftplugin/java.lua file with the following Lua code. We will go through the code in more detail.

  • We make a protected call to the…




Software engineer, Data Science and ML practitioner.