eclipse-jdtls / eclipse.jdt.ls

Java language server
1.8k stars 400 forks source link

trying to follow the main guide, but stuck at : Application "org.eclipse.jdt.ls.core.id1" could not be found in the registry #1520

Closed survivant closed 4 years ago

survivant commented 4 years ago

I'm looking for a sample / demo that call eclipse.jdt.ls from command line or better from maven. I want to to be able to apply the command "Organize imports" for my source code from the command line.

I cloned eclipse-jdt-ls repository and did this :

./mvnw clean verify -DskipTests=true -Pserver-distro I unpack the .gz file and launched it with this command line

java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.core.JavaIndexer -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar ./plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar -configuration ./config_win -data ./path/to/data --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED I had to change "-Declipse.application=org.eclipse.jdt.ls.core.id1" for something else because the application id1 is not found.

but I don't know what to do from that.

snjeza commented 4 years ago

@survivant I can't reproduce the issue.

C:\Users\Snjeza\jdtls>java -agentlib:jdwp=transport=dt_socket,server=y,suspend=n,address=1044 -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G -jar ./plugins/org.eclipse.equinox.launcher_1.5.700.v20200207-2156.jar -configuration ./config_win -data ./myworkspace --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED
Listening for transport dt_socket at address: 1044
Content-Length: 126

{"jsonrpc":"2.0","method":"window/logMessage","params":{"type":3,"message":"Jul
31, 2020, 7:47:42 PM Main thread is waiting"}}
survivant commented 4 years ago

I found the issue. I had JDK8 in my path . The problem is gone using jdk11.

jiacai2050 commented 3 years ago

@survivant @snjeza Does this mean that jdt doesn't support jdk8? I meet the same issue, and problem resolved using jdk14

jiacai2050 commented 3 years ago
snjeza commented 3 years ago

Does this mean that jdt doesn't support jdk8? I meet the same issue, and problem resolved using jdk14

Java LS requires JDK11 to run. Your project can use JDK >= 1.5. See https://github.com/redhat-developer/vscode-java/wiki/JDK-Requirements

r4ulill0 commented 2 years ago

I have tried the same but with jdk 17.0.1 and had the same problem:

PS E:\LanguageServers\java> & 'C:\Program Files\Java\jdk-17.0.1\bin\java.exe' -version
openjdk version "17.0.1" 2021-10-19
OpenJDK Runtime Environment (build 17.0.1+12-39)
OpenJDK 64-Bit Server VM (build 17.0.1+12-39, mixed mode, sharing)
PS E:\LanguageServers\java> & 'C:\Program Files\Java\jdk-17.0.1\bin\java.exe'  -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -Dlog.level=ALL -noverify -Xmx1G --add-modules=ALL-SYSTEM --add-opens java.base/java.util=ALL-UNNAMED --add-opens java.base/java.lang=ALL-UNNAMED -jar ./plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar -configuration ./config_win -data /LanguageServers/data
Error: Could not find or load main class .application=org.eclipse.jdt.ls.core.id1
Caused by: java.lang.ClassNotFoundException: /application=org/eclipse/jdt/ls/core/id1

I have changed the order of the arguments as #1934 suggests but it still fails.

Edit:

Seems that powershell needs to receive all arguments in quotes (except -jar file) to work. After running it like that the command still not work but it writes the following log:

!SESSION 2021-12-11 22:16:09.468 -----------------------------------------------
    1 eclipse.buildId=unknown
    2 java.version=17.0.1
    3 java.vendor=Oracle Corporation
    4 BootLoader constants: OS=win32, ARCH=x86_64, WS=win32, NL=es_ES
    5 Framework arguments:  -configuration ./config_win -data /LanguageServers/data
    6 Command-line arguments:  -configuration ./config_win -data /LanguageServers/data
    7
    8 !ENTRY org.eclipse.osgi 4 0 2021-12-11 22:16:09.770
    9 !MESSAGE Application error
   10 !STACK 1
   11 java.lang.IllegalStateException: Unable to acquire application service. Ensure that the org.eclipse.core.runtime bundle is resolved and started (see config.ini).
   12     at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:81)
   13     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:401)
   14     at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
   15     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   16     at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:77)
   17     at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
   18     at java.base/java.lang.reflect.Method.invoke(Method.java:568)
   19     at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
   20     at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
   21     at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
   22     at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
cabins commented 2 years ago

I got same error on Windows 10, but works well on Linux. Wired.

Shane-XB-Qian commented 2 years ago
-rwxr-xr-x 1 shane shane 53913 Aug  4 10:20 eclipse.jdt.ls/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar

i've cleaned workspace/data dir, and jdk is v11 already, but why still reported such err? // had to downgrade....................................

openjdk 11.0.15 2022-04-19
OpenJDK Runtime Environment (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1)
OpenJDK 64-Bit Server VM (build 11.0.15+10-Ubuntu-0ubuntu0.22.04.1, mixed mode, sharing)
!ENTRY org.eclipse.osgi 4 0 2022-08-04 16:14:29.565
!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:136)
    at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:402)
    at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:255)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
    at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
    at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
    at java.base/java.lang.reflect.Method.invoke(Method.java:566)
    at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:659)
    at org.eclipse.equinox.launcher.Main.basicRun(Main.java:596)
    at org.eclipse.equinox.launcher.Main.run(Main.java:1467)
    at org.eclipse.equinox.launcher.Main.main(Main.java:1440)
fbricon commented 2 years ago

@Shane-XB-Qian jdt.ls now requires Java 17 to run (you can still compile Java 1.5...18 projects)

Shane-XB-Qian commented 2 years ago

jdt.ls now requires Java 17 to run

Oh My ............... ok. // maybe some years later, jdk 17 would be the default java package with linux distr. :-)

was the ok IF put a readme into released jdtls.tar.gz package? // and saying those requirement there? :-(

fbricon commented 2 years ago

@Shane-XB-Qian feel free to open a PR

fbricon commented 2 years ago

BTW, there's now a script to launch jdt.ls, that performs the requirement checks: https://github.com/eclipse/eclipse.jdt.ls/tree/master/org.eclipse.jdt.ls.product/scripts

Shane-XB-Qian commented 2 years ago

unluckly, I have no idea about those requirement with jdtls each version, but you are right, i found looks there was bin jdtls doing check and startup already. // so supposed that should be fine as long as people noticed that there.