-
Notifications
You must be signed in to change notification settings - Fork 305
Servers Java
- Java 17 or later
I searched the Debian, Fedora, Gentoo, and Ubuntu package websites and came up empty. If you are using Arch (btw), you can install the package via the jdtls
AUR package.
As root/sudo
, install a recent JDK from pacman
:
pacman -S java-runtime-common jdk-openjdk
Make sure you have a recent Java environment selected (v17 or greater) by running archinux-java status
, and set one with archlinux-java set VERSION
(where VERSION
is the name of the Java environment you want from the list).
Then, install the AUR jdtls
package with your AUR helper of choice.
If you are on an operating system or Linux distribution that does not have a jdtls
package (most don't), you will need to download the latest tarball from the Eclipse Foundation website:
mkdir -p /tmp/jdtls.dl
cd /tmp/jdtls.dl
curl -L https://download.eclipse.org/jdtls/milestones/1.40.0/jdt-language-server-1.40.0-202409261450.tar.gz -O
Extract the tarball in the desired PREFIX
:
PREFIX="$HOME/.local"
mkdir -p "$PREFIX/share/java/jdtls"
cd "$PREFIX/share/java/jdtls"
tar -xzf /tmp/jdtls.dl/jdt-language-server-1.40.0-202409261450.tar.gz
Then, install the jdtls
helper script somewhere in your PATH
:
[ ! -d "$HOME/bin" ] && mkdir -p "$HOME/bin" && echo 'export PATH="$HOME/bin:$PATH"' >> "$HOME/.profile"
ln -s "$PREFIX/share/java/jdtls/bin/jdtls" "$HOME/bin/jdtls"
If you made changes to your PATH
, you may need to restart your shell.
if executable('jdtls')
au User lsp_setup call lsp#register_server({
\ 'name': 'Eclipse JDT Language Server',
\ 'cmd': {server_info->['jdtls', '-data', getcwd()]},
\ 'allowlist': ['java']
\ })
endif