args order
arclaxton opened this issue · comments
Hello,
I am unsure exactly why this was the case on my system (windows), but the lsp did not work out of the box for me. I was getting
Error: Could not find or load main class .application=org.eclipse.jdt.ls.core.id1
Eventually I was able to get it working by trying a tweak to the command that I found from an nvim jdtls user who had the same problem - moving all of the -D arguments to after the java -jar call. My command is now something like:
"command": [
"${java_executable}",
"--add-modules=ALL-SYSTEM",
"--add-opens",
"java.base/java.util=ALL-UNNAMED",
"--add-opens",
"java.base/java.lang=ALL-UNNAMED",
"-noverify",
"-XX:+UseParallelGC",
"-XX:GCTimeRatio=4",
"-XX:AdaptiveSizePolicyWeight=90",
"-Dsun.zip.disableMemoryMapping=true",
"-Xmx1G",
"-Xms100m",
"-jar",
"${serverdir}/plugins/org.eclipse.equinox.launcher_${launcher_version}.jar",
"-configuration",
"${serverdir}/config_${jdtls_platform}",
"-Declipse.application=org.eclipse.jdt.ls.core.id1",
"-Dosgi.bundles.defaultStartLevel=4",
"-Declipse.product=org.eclipse.jdt.ls.core.product",
"-Dfile.encoding=UTF-8",
"-DwatchParentProcess=${watch_parent_process}",
"-data",
"${datadir}"
]
Still not sure why my computer can't handle -D args coming first when clearly others can, but I wanted to suggest perhaps rearranging them in the default command in case anyone else could have the same problem solved this way.
There's still this define here:
"-Dsun.zip.disableMemoryMapping=true",
why does this one not matter?
My apologies, I think I had tried a few different things at once and confused the arg order for what finally got it working. What actually fixed my lsp config was adding the param -Declipse.application.launchDefault=false
to the command, as recommended here. Changing the order of the arguments does not seem to help anything after all.