Navigation Menu

Skip to content
sciencesakura edited this page Dec 3, 2019 · 6 revisions

Requirements

  • Java 1.8 or later

Install

Download jar file

mkdir -p ~/lsp/eclipse.jdt.ls
cd ~/lsp/eclipse.jdt.ls
curl -L http://download.eclipse.org/jdtls/milestones/0.47.0/jdt-language-server-0.47.0-201911150945.tar.gz -O
tar xf jdt-language-server-0.47.0-201911150945.tar.gz

Registering in .vimrc

if executable('java') && filereadable(expand('~/lsp/eclipse.jdt.ls/plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar'))
    au User lsp_setup call lsp#register_server({
        \ 'name': 'eclipse.jdt.ls',
        \ 'cmd': {server_info->[
        \     'java',
        \     '-Declipse.application=org.eclipse.jdt.ls.core.id1',
        \     '-Dosgi.bundles.defaultStartLevel=4',
        \     '-Declipse.product=org.eclipse.jdt.ls.core.product',
        \     '-Dlog.level=ALL',
        \     '-noverify',
        \     '-Dfile.encoding=UTF-8',
        \     '-Xmx1G',
        \     '-jar',
        \     expand('~/lsp/eclipse.jdt.ls/plugins/org.eclipse.equinox.launcher_1.5.600.v20191014-2022.jar'),
        \     '-configuration',
        \     expand('~/lsp/eclipse.jdt.ls/config_win'),
        \     '-data',
        \     getcwd()
        \ ]},
        \ 'whitelist': ['java'],
        \ })
endif

Change config_win according to the environment.

  • Windows: config_win
  • Linux: config_linux
  • Mac: config_mac