neoclide / coc-java

Java extension for coc.nvim
Eclipse Public License 1.0
453 stars 39 forks source link

Error: The "java" server crashed 5 times in the last 3 minutes. The server will not be restarted #99

Closed milad2golnia closed 4 years ago

milad2golnia commented 4 years ago

I have coc.nvim installed and to install this extension, I just opened the vim and ran below command: :CocInstall coc-java the output is: Install finished - ✓ coc-java Installed extension coc-java@1.4.11 at /home/milad/.config/coc/extensions/node_modules/coc-java But when I open a .java file, I first see: [coc.nvim] JDT Language Server starting at /home/path/to/my/directory and after some seconds I face below Error: [coc.nvim] The "java" server crashed 5 times in the last 3 minutes. The server will not be restarted. I'm on linux and I can write java files in Visual Studio Code normally if it helps anyway. some Information: $ java -version openjdk version "10.0.2" 2018-07-17 OpenJDK Runtime Environment (build 10.0.2+13) OpenJDK 64-Bit Server VM (build 10.0.2+13, mixed mode) $ echo $JAVA_HOME /usr/lib/jvm/java-11-openjdk

pr4th4m commented 4 years ago

Getting the same error

Screen Shot 2020-07-25 at 7 44 15 pm
pr4th4m commented 4 years ago

Error from server

!SESSION 2020-07-25 20:55:04.141 -----------------------------------------------
eclipse.buildId=unknown
java.version=1.8.0_231
java.vendor=Oracle Corporation
BootLoader constants: OS=macosx, ARCH=x86_64, WS=cocoa, NL=en_AU
Command-line arguments:  -data /Users/nevagipr/.config/coc/extensions/coc-java-data/jdt_ws_d2b263b5c91808897dc46fc16462ce2e

!ENTRY org.eclipse.jdt.ls.core 4 0 2020-07-25 20:55:04.693
!MESSAGE FrameworkEvent ERROR
!STACK 0
org.osgi.framework.BundleException: Could not resolve module: org.eclipse.jdt.ls.core [47]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

    at org.eclipse.osgi.container.Module.start(Module.java:463)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel$2.run(ModuleContainer.java:1845)
    at org.eclipse.osgi.internal.framework.EquinoxContainerAdaptor$1$1.execute(EquinoxContainerAdaptor.java:136)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1838)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.incStartLevel(ModuleContainer.java:1781)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.doContainerStartLevel(ModuleContainer.java:1743)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1665)
    at org.eclipse.osgi.container.ModuleContainer$ContainerStartLevel.dispatchEvent(ModuleContainer.java:1)
    at org.eclipse.osgi.framework.eventmgr.EventManager.dispatchEvent(EventManager.java:234)
    at org.eclipse.osgi.framework.eventmgr.EventManager$EventThread.run(EventManager.java:345)

!ENTRY org.eclipse.osgi 4 0 2020-07-25 20:55:04.708
!MESSAGE Bundle initial@reference:file:plugins/org.eclipse.jdt.ls.core_0.60.0.202007230941.jar was not resolved.

!ENTRY org.eclipse.jdt.ls.core 2 0 2020-07-25 20:55:04.716
!MESSAGE Could not resolve module: org.eclipse.jdt.ls.core [47]
  Unresolved requirement: Require-Capability: osgi.ee; filter:="(&(osgi.ee=JavaSE)(version=11))"

!ENTRY org.eclipse.osgi 4 0 2020-07-25 20:55:04.716
!MESSAGE Application error
!STACK 1
java.lang.RuntimeException: Application "org.eclipse.jdt.ls.core.id1" could not be found in the registry. The applications available are: org.eclipse.ant.core.antRunner, org.eclipse.equinox.app.error, org.eclipse.jdt.apt.core.aptBuild, org.eclipse.jdt.core.JavaIndexer.
    at org.eclipse.equinox.internal.app.EclipseAppContainer.startDefaultApp(EclipseAppContainer.java:252)
    at org.eclipse.equinox.internal.app.MainApplicationLauncher.run(MainApplicationLauncher.java:33)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:137)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:107)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.lang.reflect.Method.invoke(Method.java:498)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:657)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:594)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1447)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1420)
pr4th4m commented 4 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/

Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

fcying commented 4 years ago

Getting the same error.

OS: debian 10
java -version
openjdk version "1.8.0_252"
OpenJDK Runtime Environment (AdoptOpenJDK)(build 1.8.0_252-b09)
OpenJDK 64-Bit Server VM (AdoptOpenJDK)(build 25.252-b09, mixed mode)

echo $JAVA_HOME
/usr/lib/jvm/adoptopenjdk-8-hotspot-amd64

use Version 57 of JDT Lang Sever not get error

milad2golnia commented 4 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/

Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

Thank you very much, It solved the problem simply and it works now like a charm:)

nicobao commented 4 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/

Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

I just solved it the same way using the latest jdt lang server today, which is v0.9.0: https://download.eclipse.org/jdtls/milestones/0.9.0/ I suspect that using 0.57.0 will result in lower capabilities. There seems to be a bug with the way coc-java is downloading the language server.

EDIT: I was wrong, 0.9.0 is from 2017. Download: "jdt-language-server-latest.tar.gz" from https://download.eclipse.org/jdtls/snapshots/?d in one way or another and run it with Java 11.

mapperr commented 4 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/ Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

I just solved it the same way using the latest jdt lang server today, which is v0.9.0: https://download.eclipse.org/jdtls/milestones/0.9.0/ I suspect that using 0.57.0 will result in lower capabilities. There seems to be a bug with the way coc-java is downloading the language server.

That worked for me too (I'm on archlinux with neovim and openjdk 1.8). Thanks.

luanmateuz commented 4 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/ Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

I just solved it the same way using the latest jdt lang server today, which is v0.9.0: https://download.eclipse.org/jdtls/milestones/0.9.0/ I suspect that using 0.57.0 will result in lower capabilities. There seems to be a bug with the way coc-java is downloading the language server.

Thank you man, worked! Ubuntu with Vim 8.2 and openjdk 1.8

adworacz commented 4 years ago

Adding another +1 - downloading the latest JDT from Eclipse's website and overwriting what coc's populating in the extensions directory is the fix.

So something's going wrong when coc.nvim populates that directory.

nicobao commented 4 years ago

Actually, the latest eclipse jdt lsp is NOT 0.9 but currently 0.61.0. That's the one I use now and it works perfectly fine, as long as you run it with Java 11. Sorry for the mess. You can see that here: https://download.eclipse.org/jdtls/snapshots/?d the date for release 0.9 is in 2017. The "jdt-language-server-latest.tar.gz" package is 0.61.0 according to "latest.txt", and the corresponding date is in 2020. Also you can see that Eclipse CI latest build is 0.61.0 from master here: https://ci.eclipse.org/ls/job/jdt-ls-master/ @adworacz @hellowluan @mapperr you should probably migrate or I suspect you will experience lower capabilities.

I don't know what's the matter with these 0.7/0.8/0.9 versions, maybe they tried some advanced features and finally gave them up. You can search in Eclipse CI if you want, and in their Github repo, it's all public.

mapperr commented 4 years ago

Actually, the latest eclipse jdt lsp is NOT 0.9 but currently 0.61.0. That's the one I use now and it works perfectly fine, as long as you run it with Java 11. Sorry for the mess.

That's it. Confirmed all working with java 11. Thanks!

adworacz commented 4 years ago

Indeed, thank you - I downloaded the latest *tar.gz from your link: https://ci.eclipse.org/ls/job/jdt-ls-master/

At the time of this writing, that's jdt-language-server-0.61.0-202009090949.tar.gz.

I overwrote all files/folders at ~/.config/coc/extensions/coc-java-data/server/ with the files and folders I extracted from said *.tar.gz file.

That, and running with Java 11 (as provided/setup by SDKMAN!), I'm off to the races with a working coc-java install. Tested it with an existing package, and it's certainly faster than the "0.9" version.

zxm66 commented 4 years ago

Thank you so much..

fcying commented 4 years ago

I'm using AdoptOpenJDK build 1.8.0_265-b01, it only work with 0.57 version.

jiftle commented 4 years ago

me, too. os: deepin V20 jdk: openjdk version "1.8.0_212" OpenJDK Runtime Environment (build 1.8.0_212-8u212-b01-1~deb9u1-b01) OpenJDK 64-Bit Server VM (build 25.212-b01, mixed mode)

jacksonludwig commented 4 years ago

I had this issue as well just today and had to manually download the latest myself, which was 0.64, from https://ci.eclipse.org/ls/job/jdt-ls-master/

CapSel commented 3 years ago

I'm reproducing this problem every time I try to open ... any java file from our android project.

nicobao commented 3 years ago

Are you using Java 11? The lsp requires Java 11 minimum. Besides, the LSP doesn't fully support Gradle Android projects. And sometimes, a simple ":e" on a file, or "CocRestart", or a clean of workspace suffice to solve the situation.

Le jeu. 12 nov. 2020 à 12:32, CapSel notifications@github.com a écrit :

I'm reproducing this problem every time I try to open ... any java file from our android project.

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neoclide/coc-java/issues/99#issuecomment-726022266, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBYMI4TNXQXJUHKMVLNY23SPPBWJANCNFSM4PE3DEPA .

jacksonludwig commented 3 years ago

I have java 14 and this happens to me.

luanmateuz commented 3 years ago

enter the coc-java folder and replace the files with the eclipse-jdtls. https://download.eclipse.org/jdtls/snapshots/?d

muhammadFawzy commented 3 years ago

Nothing works for me i replaced it many times and changed from java 8 to 11 and 15 but still didn't work Os : macOS JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk-11.0.9.jdk/Contents/Home any help?

nicobao commented 3 years ago

Nothing works for me i replaced it many times and changed from java 8 to 11 and 15 but still didn't work Os : macOS JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk-11.0.9.jdk/Contents/Home any help?

You need Java 11. Normally it should work. Please copy paste the file coc-settings.json. Type :CocConfig to get it. Also, tell me the content of ~/.config/coc/extensions/coc-java-data/server please

muhammadFawzy commented 3 years ago

Nothing works for me i replaced it many times and changed from java 8 to 11 and 15 but still didn't work Os : macOS JAVA_HOME: /Library/Java/JavaVirtualMachines/jdk-11.0.9.jdk/Contents/Home any help?

You need Java 11. Normally it should work. Please copy paste the file coc-settings.json. Type :CocConfig to get it. Also, tell me the content of ~/.config/coc/extensions/coc-java-data/server please

my Config is

{
  // suggestions
  // "suggest.echodocSupport": true,
  // TODO add more labels and give them cool glyphs
  "suggest.completionItemKindLabels": {
    "text": "t",
    "method": "m",
    "function": ""
  },
  "snippets.priority": 1,
  //"yank.priority": 1,
  "suggest.languageSourcePriority": 99,
  "coc.source.file.priority": 2,
  "coc.source.around.priority": 3,
  "coc.source.buffer.priority": 4,

  // diagnostics
  "diagnostic.errorSign": " ",
  "diagnostic.warningSign": " ",
  "diagnostic.infoSign": "",
  "diagnostic.hintSign": " ",
  // "diagnostic.displayByAle": true,
  // "diagnostic.virtualText": true, // this won't work with codelens when error on same line

  // codelens
  "codeLens.enable": true,
  "java.referencesCodeLens.enabled": true,
  "java.implementationsCodeLens.enabled": true,
  "java.completion.enabled": true,
  "java.jdt.ls.vmargs": "-javaagent:/usr/local/share/lombok/lombok.jar",

  // list
  "list.indicator": ">",
  "list.selectedSignText": " ",

  // autoformat
  "coc.preferences.formatOnSaveFiletypes": [
    "css",
    "markdown",
    "javascript",
    "graphql",
    "html",
    "yaml",
    "json",
    "python",
    "java"
  ],
  "coc.preferences.hoverTarget": "float",

  // python config
  "python.analysis.autoImportCompletions": true,
  "python.analysis.autoSearchPaths": true,
  "python.analysis.diagnosticMode": "openFilesOnly",
  "python.analysis.stubPath": "typings",
  "python.analysis.typeshedPaths": [],
  "python.analysis.diagnosticSeverityOverrides": {},
  "python.analysis.typeCheckingMode": "basic",
  "python.analysis.useLibraryCodeForTypes": true,
  "python.pythonPath": "python",
  "python.venvPath": "",
  "python.formatting.provider": "black",
  "python.formatting.blackPath": "black",
  "python.formatting.blackArgs": [],
  "python.formatting.autopep8Path": "autopep8",
  "python.formatting.autopep8Args": [],
  "python.formatting.yapfPath": "yapf",
  "python.formatting.yapfArgs": [],
  "python.linting.enabled": true,
  "python.linting.flake8Enabled": false,
  "python.linting.banditEnabled": false,
  "python.linting.mypyEnabled": false,
  "python.linting.pytypeEnabled": false,
  "python.linting.prospectorEnabled": false,
  "python.linting.pydocstyleEnabled": false,
  "python.linting.pylamaEnabled": false,
  "python.linting.pylintEnabled": false,
  "pyright.disableCompletion": false,
  "pyright.disableLanguageServices": false,
  "pyright.disableOrganizeImports": false,

  // snippets
  "snippets.ultisnips.directories": ["UltiSnips", "~/.config/nvim/snips"],
  //"snippets.userSnippetsDirectory": "~/.config/nvim/snips",

  // emmet
  "emmet.includeLanguages": {
    "vue-html": "html",
    "javascript": "javascriptreact"
  },

  // CSS (disable since I'm also using stylelintplus)
  "css.validate": false,
  "less.validate": false,
  "scss.validate": false,
  "wxss.validate": false,

  // explorer
  "explorer.width": 30,
  "explorer.file.root.template": "[icon] [git] [hidden & 1][root]",
  "explorer.icon.enableNerdfont": true,
  "explorer.previewAction.onHover": false,
  "explorer.icon.enableVimDevicons": false,
  "explorer.file.showHiddenFiles": false,
  "explorer.keyMappings.global": {
    "<cr>": ["expandable?", "expand", "open"],
    "v": "open:vsplit"
  },

  "languageserver": {
    "lua": {
      "command": "/home/chris/.luambenvs/neovim4/bin/lua-lsp",
      "filetypes": ["lua"],
      "trace.server": "verbose"
    }
  },

  "bookmark.sign": "",

  //coc-emoji
  "coc.source.emoji.filetypes": ["markdown"]

  // lua
  //"lua.useSumnekoLs": true,
  //"lua.commandPath": "/home/chris/.luambenvs/neovim3/bin/lua-lsp"
  //"lua.enable": true,
  //"Lua.completion.enable": true,
  //"Lua.runtime.version": "Lua 5.1",
  //"Lua.runtime.path": ["?.lua", "?/init.lua", "?/?.lua"],
  //"lua.version": "5.1"
  //"lua.commandPath": "/home/chris/.vscode-insiders/extensions/sumneko.lua-1.0.5/server/bin/Linux/lua-language-server"

  // TODO b:coc_suggest_disable=1 GOYO
  // TODO add to paths.vim g:coc_node_path
}

about the content : config_linux config_mac config_ss_linux config_ss_mac config_ss_win config_win features plugins

nicobao commented 3 years ago

I suspect your problems lie with java.jdt.ls.vmargs parameter Check here: https://github.com/eclipse/eclipse.jdt.ls/issues/824#issuecomment-741857420 For default parameters. Install coc-json (or jsonc, not sure), to get autocomplete in :CocConfig for next time. I think you may have removed important default parameters instead of adding your lombok parameter to it.

Besides, can you try renaming the folder I told you, and try to download the Java language server from within vim (:CocCommand java.updateLanguageServer)? Delete the old folder if it now works.

Before doing all that you can also use java.trace.server=true or something like that (see readme troubleshooting of this repo and cox.nvim repo) and then, open the server log with the corresponding coc Java command, to look for an error, then paste it here. Would be nice also if you could tell us the version of the language server you're running.

muhammadFawzy commented 3 years ago

I suspect your problems lie with java.jdt.ls.vmargs parameter Check here: eclipse/eclipse.jdt.ls#824 (comment) For default parameters. Install coc-json (or jsonc, not sure), to get autocomplete in :CocConfig for next time. I think you may have removed important default parameters instead of adding your lombok parameter to it.

Besides, can you try renaming the folder I told you, and try to download the Java language server from within vim (:CocCommand java.updateLanguageServer)? Delete the old folder if it now works.

Before doing all that you can also use java.trace.server=true or something like that (see readme troubleshooting of this repo and cox.nvim repo) and then, open the server log with the corresponding coc Java command, to look for an error, then paste it here. Would be nice also if you could tell us the version of the language server you're running.

It works for me language server = 68 java 11

Thanks

nicobao commented 3 years ago

Could you tell mewhat was wrong? Which step helped you succeed?

Le mer. 6 janv. 2021 à 13:02, Mohamed Fawzy notifications@github.com a écrit :

I suspect your problems lie with java.jdt.ls.vmargs parameter Check here: eclipse/eclipse.jdt.ls#824 (comment) https://github.com/eclipse/eclipse.jdt.ls/issues/824#issuecomment-741857420 For default parameters. Install coc-json (or jsonc, not sure), to get autocomplete in :CocConfig for next time. I think you may have removed important default parameters instead of adding your lombok parameter to it.

Besides, can you try renaming the folder I told you, and try to download the Java language server from within vim (:CocCommand java.updateLanguageServer)? Delete the old folder if it now works.

Before doing all that you can also use java.trace.server=true or something like that (see readme troubleshooting of this repo and cox.nvim repo) and then, open the server log with the corresponding coc Java command, to look for an error, then paste it here. Would be nice also if you could tell us the version of the language server you're running.

It works for me language server = 68 java 11

Thanks

— You are receiving this because you commented. Reply to this email directly, view it on GitHub https://github.com/neoclide/coc-java/issues/99#issuecomment-755260526, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBYMI6EANXAO5VQ5MVYU5DSYRGO5ANCNFSM4PE3DEPA .

muhammadFawzy commented 3 years ago

Could you tell mewhat was wrong? Which step helped you succeed? Le mer. 6 janv. 2021 à 13:02, Mohamed Fawzy notifications@github.com a écrit : I suspect your problems lie with java.jdt.ls.vmargs parameter Check here: eclipse/eclipse.jdt.ls#824 (comment) <eclipse/eclipse.jdt.ls#824 (comment)> For default parameters. Install coc-json (or jsonc, not sure), to get autocomplete in :CocConfig for next time. I think you may have removed important default parameters instead of adding your lombok parameter to it. Besides, can you try renaming the folder I told you, and try to download the Java language server from within vim (:CocCommand java.updateLanguageServer)? Delete the old folder if it now works. Before doing all that you can also use java.trace.server=true or something like that (see readme troubleshooting of this repo and cox.nvim repo) and then, open the server log with the corresponding coc Java command, to look for an error, then paste it here. Would be nice also if you could tell us the version of the language server you're running. It works for me language server = 68 java 11 Thanks — You are receiving this because you commented. Reply to this email directly, view it on GitHub <#99 (comment)>, or unsubscribe https://github.com/notifications/unsubscribe-auth/ALBYMI6EANXAO5VQ5MVYU5DSYRGO5ANCNFSM4PE3DEPA .

it was because this one java.jdt.ls.vmargs

esorylul commented 3 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/ Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

I just solved it the same way using the latest jdt lang server today, which is v0.9.0: https://download.eclipse.org/jdtls/milestones/0.9.0/ I suspect that using 0.57.0 will result in lower capabilities. There seems to be a bug with the way coc-java is downloading the language server.

EDIT: I was wrong, 0.9.0 is from 2017. Download: "jdt-language-server-latest.tar.gz" from https://download.eclipse.org/jdtls/snapshots/?d in one way or another and run it with Java 11.

thinks! It`s work on windows10 with neovim-qt

fabOnReact commented 3 years ago

does not work with https://github.com/facebook/react-native/blob/master/ReactAndroid/build.gradle (a gradle/buck android project) I'm reading this article on how to configure manually eclipse.jdt.ls https://zignar.net/2019/11/21/setup-neovim-for-java-development/

but I wonder if the problem is with eclipse.jdt.ls itself

Limited Gradle support (Android projects are not supported)

https://github.com/eclipse/eclipse.jdt.ls https://github.com/redhat-developer/vscode-java/issues/10#issuecomment-268834749 https://github.com/greensopinion/gradle-android-eclipse

so is there a language server out there compatible with Gradle based android projects?

chris-av commented 3 years ago

I got the same exact error. I found that :CocUninstall did not actually remove the .config/coc/extensions/coc-java-data. I ran the :CocUninstall coc-java, then manually removed .config/coc/extensions/coc-java-data. Once I ran :CocInstall coc-java again, the language server started to work again. The error must be in how it is initially downloaded.

juanMarinero commented 3 years ago

I just did :CocCommand java.updateLanguageServer (from coc-java#setting-the-jdk), waited, and restarted Vim. Ubuntu 20.04 && Vim 8.2

Fatpandac commented 3 years ago

JDK : 16.0.2 jdt.ls : 0.57 OS : Windows11 It can run!!! I need help!!!

kaiyulee commented 3 years ago

macOS

jdt.ls auto installed when CocInstall coc-java (latest)

:CocConfig open coc-settings.json file.

set java.home like:

{
    "java.home": "/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home",
    "java.trace.server": "verbose",
    "java.format.enabled": true,
    "java.import.maven.enabled": true,
    "java.maven.downloadSources": true
}

WORKED!

"java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home",, java 8 won't work!

As mentioned above, I think it should work when jdk version > 8

Fatpandac commented 3 years ago

macOS

jdt.ls auto installed when CocInstall coc-java (latest)

:CocConfig open coc-settings.json file.

set java.home like:

{
    "java.home": "/Library/Java/JavaVirtualMachines/adoptopenjdk-13.jdk/Contents/Home",
    "java.trace.server": "verbose",
    "java.format.enabled": true,
    "java.import.maven.enabled": true,
    "java.maven.downloadSources": true
}

WORKED!

"java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_271.jdk/Contents/Home",, java 8 won't work!

As mentioned above, I think it should work when jdk version > 8

I can find the path in my Java folder on Windows. image

idr4n commented 3 years ago

I just did :CocCommand java.updateLanguageServer (from coc-java#setting-the-jdk), waited, and restarted Vim. Ubuntu 20.04 && Vim 8.2

Thanks @juanMarinero, this worked for me in archlinux.

rockneverdies55 commented 2 years ago

After trying all the steps above it started successfully only after I issued :CocCommand java.clean.workspace command.

ChheavBunHeng commented 2 years ago

Error: The "java" server crashed 5 times in the last 3 minutes. The server will not be restarted Basically this is only happen, IF you either accidentally or incidentally delete the workshop folder rather than just the file in WorkspaceStroage Linux: /home/duck(UserName)/.config/code/User/workspaceStorage/ just go back and do not delete WorkSpaceStorage folder but the file in that folder work like a charm

geeksilva97 commented 2 years ago

It definitely doesn't work with version 8. I switched to a newer one and everything is working fine.

timmyjose commented 2 years ago

After trying all the steps above it started successfully only after I issued :CocCommand java.clean.workspace command.

Thanks for that - it'd become annoying to the point that I was ready to uninstall coc-java.

kqvanity commented 2 years ago

As for me, i thought that i've already set the JAVA_HOME, but i didn't. Either way, setting that path for the JDK did the job.

David-Carr-C commented 2 years ago

Version 57 of JDT Lang Sever works fine https://download.eclipse.org/jdtls/milestones/0.57.0/ Quick hack for those who are facing this issue Replace all directories/files in ~/.config/coc/extensions/coc-java-data/server with directories/files from above extracted JDT lang server tar.

Thank you very much, It solved the problem simply and it works now like a charm:)

It works for me too.

rvyhvn commented 1 year ago

Hello, i'm facing this issue right now, i'm new in neovim and all of configs. I got confused about the jdtls thing. I don't use Lua as config files for Neovim. The directory in my ~/.config/coc/extensions/coc-java-data is only a directory called "1.14.1". Could someone help me please?