eclipse.jdt.ls icon indicating copy to clipboard operation
eclipse.jdt.ls copied to clipboard

how to start language server in socket mode and wait for client to connect?

Open 1014661165 opened this issue 3 years ago • 1 comments

In the readme.md it says that the jdtls can only set CLIENT_HOST and CLIENT_PORT environment variables before starting the server in socket mode, but it is unusual to common socket server usage. Could jdtls works like normal socket server? I mean to start it and wait for the connecting of clients?

1014661165 avatar Apr 24 '22 04:04 1014661165

@1014661165 you can try

  • set the following environment variables
export CLIENT_PORT=5036
export CLIENT_HOST=localhost
  • start the server with
env socket.stream.debug=true java \
-agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1045 \
-Declipse.application=org.eclipse.jdt.ls.core.id1 \
-Dosgi.bundles.defaultStartLevel=4 \
-Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.protocol=true \
-Dlog.level=ALL -noverify -Xmx1G \
-jar ./plugins/org.eclipse.equinox.launcher_*.jar \
-configuration ./config_linux -data ~/myworkspace \
--add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED \
--add-opens java.base/java.lang=ALL-UNNAMED \
-consoleLog -debug

See Running from the command line

  • open https://github.com/redhat-developer/vscode-java in VS Code
  • run Launch Extension - JDLS Client
  • debug the server on port 1045

snjeza avatar Apr 25 '22 00:04 snjeza

Closing for now, but if there's issues with the instructions feel free to re-open.

rgrunber avatar Aug 24 '22 03:08 rgrunber