eclipse-jdtls / eclipse.jdt.ls

Java language server
1.81k stars 404 forks source link

Getting - {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"12-Jan-2024, 12:00:51 am Main thread is waiting"}} on insallation #3021

Closed Dhrooven closed 1 month ago

Dhrooven commented 10 months ago

I downloaded Milestone snapshot version 1.30.1.

ran this command -

java \
    -Declipse.application=org.eclipse.jdt.ls.core.id1 \
    -Dosgi.bundles.defaultStartLevel=4 \
    -Declipse.product=org.eclipse.jdt.ls.core.product \
    -Dlog.level=ALL \
    -Djava.util.logging.ConsoleHandler.level=ALL \
    -Xmx1G \
    --add-modules=ALL-SYSTEM \
    --add-opens java.base/java.util=ALL-UNNAMED \
    --add-opens java.base/java.lang=ALL-UNNAMED \
    -jar /home/dj/Downloads/jdt-language-server-1.30.1-202312071447/plugins/org.eclipse.equinox.launcher_1.6.600.v20231106-1826.jar \
    -configuration /home/dj/Downloads/jdt-language-server-1.30.1-202312071447/config_linux \
    -data /home/dj/Desktop/Programming/Java

I am getting this output - {"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"12-Jan-2024, 12:00:51 am Main thread is waiting"}}

Upon running - jps -l i got -

3952 /home/dj/Downloads/jdt-language-server-1.30.1-202312071447/plugins/org.eclipse.equinox.launcher_1.6.600.v20231106-1826.jar
20605 jdk.jcmd/sun.tools.jps.Jps

I waited for quite some time, still wouldn't run.

rgrunber commented 10 months ago

You started the language server and it's just waiting for a connection. You need to connect to it with some client. The simplest way to do this is probably with socat. I described how to go about this at https://github.com/eclipse-jdtls/eclipse.jdt.ls/issues/2313#issuecomment-1309651847 . I also wrote about this at https://rgrunber.github.io/vscode/java/lsp/language/server/2023/09/18/talk-to-language-server.html .

If you look at https://github.com/eclipse-jdtls/eclipse.jdt.ls#clients , you'll see a variety of known clients that are able to connect to the language server.

dipeshyadav331 commented 10 months ago

I am getting the same result, do I need to install socat from brew to proceed further?

Dhrooven commented 10 months ago

No need for installing socat. I resolved it using nvim-jdtls. Follow the steps mentioned over on the nvim-jdtls installation page. If any doubt, reply.

dipeshyadav331 commented 10 months ago

can you please share the link of the page you are talking of, I have spent hours but still unable to do, your help would be greatly appreciated. I want to setup code linting in my java codes.

Dhrooven commented 10 months ago

https://github.com/eclipse-jdtls/eclipse.jdt.ls#clients

Checkout this list of clients supported for eclipse-jdtls. And let me know, which one of them are you using?

rgrunber commented 10 months ago

If you want to use JDT-LS, that link contains most of the well-known clients. However, you wouldn't usually need to start the server yourself as most clients would handle that for you (as well as embedding the server and configuring it in a way they know would work for the client). The comment about socat was just if you want to play around with JDT-LS and see how a language server works.

dipeshyadav331 commented 10 months ago

https://github.com/eclipse-jdtls/eclipse.jdt.ls#clients

Checkout this list of clients supported for eclipse-jdtls. And let me know, which one of them are you using?

Actually, I want to use code linting in CP editor, I have to give arguments for it and I am not sure which client I need to use.

image

This editor has the same compile command which is used in the terminal, like for compiling java code, this commands are used by me.

image

I tried to first run in terminal, then I am stuck at the same place where you stucked few days back,{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"12-Jan-2024, 12:00:51 am Main thread is waiting"}}

Now, I am not understanding which client to use as the clients are for sublime, vscode, nvim etc. and I want to use it for different editor which is not present in the list.

Can you please help me!

rgrunber commented 10 months ago

Seems like if you follow https://cpeditor.org/docs/setup/#java-server it should work.

I don't think you need to start the server yourself. If you provide the arguments under that "Java Server" tab it should automatically start it for you.