eclipse-jdtls / eclipse.jdt.ls

Java language server
1.8k stars 401 forks source link

Cannot run server on apple M2 silicon #2680

Open michaelphop opened 1 year ago

michaelphop commented 1 year ago

java --version

openjdk 20.0.1 2023-04-18
OpenJDK Runtime Environment (build 20.0.1+9-29)
OpenJDK 64-Bit Server VM (build 20.0.1+9-29, mixed mode, sharing)

The command used to start the server:

['-DCLIENT_PORT=12345', '-Declipse.application=org.eclipse.jdt.ls.core.id1', '-Dosgi.bundles.defaultStartLevel=4', '-Declipse.product=org.eclipse.jdt.ls.core.product', '-Xms1G', '-Dlog.level=ALL', '--add-modules=ALL-SYSTEM', '--add-opens', 'java.base/java.util=ALL-UNNAMED', '--add-opens', 'java.base/java.lang=ALL-UNNAMED', '-jar', PosixPath('/Users/michaelpeleg/Projects/jdt-language-server-1.24.0-202305301545/plugins/org.eclipse.equinox.launcher_1.6.400.v20210924-0641.jar'), '-data', '/var/folders/fb/2ms2g_x936sfc4xgh6wl5mkm0000gn/T/jdtls-9a5d56716d566997fa290054d161af96305aff9a', '-configuration', PosixPath('/Users/michaelpeleg/Projects/jdt-language-server-1.24.0-202305301545/config_mac')]

!SESSION 2023-06-01 09:30:43.244 ----------------------------------------------- eclipse.buildId=unknown java.version=20.0.1 java.vendor=Oracle Corporation BootLoader constants: OS=macosx, ARCH=aarch64, WS=cocoa, NL=en_IL Command-line arguments: -data /var/folders/fb/2ms2g_x936sfc4xgh6wl5mkm0000gn/T/jdtls-9a5d56716d566997fa290054d161af96305aff9a

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-06-01 09:30:43.783 !MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.equinox.launcher.cocoa.macosx.x86_64 2 0 2023-06-01 09:30:43.808 !MESSAGE Could not resolve module: org.eclipse.equinox.launcher.cocoa.macosx.x86_64 [33] Unresolved requirement: Require-Capability: eclipse.platform; filter:="(& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) )" Unresolved requirement: Require-Capability: eclipse.platform; filter:="(& (osgi.ws=cocoa) (osgi.os=macosx) (osgi.arch=x86_64) )"

rgrunber commented 1 year ago

The bundle that's used is ws=cocoa, os=macosx, arch=x86_64 but going by your detected settings, you have arch=aarch64, and we don't seem to currently provide that. It's available upstream at https://github.com/eclipse-equinox/equinox/tree/master/bundles/org.eclipse.equinox.launcher.cocoa.macosx.aarch64 so it should be possible to provide. @fbricon , thoughts ?

jdneo commented 1 year ago

It so happens that my colleague has a M2 machine (Mac mini 2023). The extension can be launched correctly on his M2 with JDK 17.

!SESSION 2023-06-08 11:18:34.153 -----------------------------------------------
eclipse.buildId=unknown
java.version=17.0.7
java.vendor=Eclipse Adoptium
BootLoader constants: OS=macosx, ARCH=aarch64, WS=cocoa, NL=zh_CN_#Hans
Command-line arguments:  -data /Users/xxx/Library/Application Support/Code/User/workspaceStorage/xxx/redhat.java/jdt_ws

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-06-08 11:18:38.009
!MESSAGE class org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin is started

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-06-08 11:18:38.278
!MESSAGE Main thread is waiting

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-06-08 11:18:38.300
!MESSAGE >> initialize

!ENTRY org.eclipse.jdt.ls.core 1 0 2023-06-08 11:18:38.335
!MESSAGE Initializing Java Language Server 1.24.0.202306011331

...

Is that caused due to Java 20 is used from the user?

rgrunber commented 1 year ago

Perhaps Eclipse is able to match against the cocoa.macosx.x86_64 platform-specific bundles. We definitely don't ship the aarch64 one. I did read that with Rosetta, it should be possible to run the x86_64 binaries so perhaps this is supported.

It would be good to at least figure out where the code that handles this occurs (upstream) though.