vscode-java icon indicating copy to clipboard operation
vscode-java copied to clipboard

Language Support for Java(TM) by Red Hat - Couldn't start client Language Support for Java

Open atang0404 opened this issue 10 years ago • 61 comments

Hi guys:

I just recently installed the Language Support for Java extension however, I can't seem to get it working. Whenever I open a Java file I get a message stating the it "Couldn't start client Language Support for Java".

I get an error output that reads:

[Error - 11:54:37 PM] Starting client failed 13

I've already checked to see if JAVA_HOME is mapped under Environment Variables and it has. Any help would be appreciated. Thanks! Alexander Tang

atang0404 avatar Sep 27 '16 03:09 atang0404

can't run java! C:\Program Files (x86)\Java\jdk1.8.0_101

java version "1.8.0_101" Java(TM) SE Runtime Environment (build 1.8.0_101-b13) Java HotSpot(TM) Client VM (build 25.101-b13, mixed mode, sharing)

newxpp avatar Apr 24 '17 16:04 newxpp

@newxpp can you please enable logging so we can understand why the client fails to start?

fbricon avatar Apr 24 '17 16:04 fbricon

TL;DR — Download the junixsocket-parent-2.0.4 source, then build with maven.

I'm running a 32bit Ubuntu 12.04 guest on a VirtualBox VM. JDK 1.8.0_131-b11.

After downloading the VS Code version 1.12.0 yesterday, I got that same "Library 'libjunixsocket-native-2.0.4.so' not found!" error others reported.

My Ubuntu 12.04 VM is 32bit. The 'libjunixsocket-native-2.0.4.so' library that Microsoft distributes with the 32 bit version of Code 1.12.0, was built for a 64bit machine!

What fixed it for me, was this...

  • [ ] Backup all the jars in '[your.home.dir]/.vscode/extensions/redhat.java-0.3.0/server/config_linux/org.eclipse.osgi/45/0/.cp/lib'

  • [ ] Download the junixsocket-parent-2.0.4 source from here, then untar it to wherever

  • [ ] cd to the parent project [junixsocket-junixsocket-parent-2.0.4]

  • [ ] Build with 'mvn package' [you might have to cd into junixsocket-native-common and junixsocket-native if they're not built by the parent]

  • [ ] Combine the contents of the following jars and folders into one single jar — then name that newly-created jar 'junixsocket-native-common-2.0.4.jar' [I stitched mine together manually. But you could probably hack the pom and have maven do it for you]

junixsocket-junixsocket-parent-2.0.4/junixsocket-native-common/target/META-INF
junixsocket-junixsocket-parent-2.0.4/junixsocket-native-common/target/junixsocket-native-common-2.0.4.jar
junixsocket-junixsocket-parent-2.0.4/junixsocket-native/target/META-INF
junixsocket-junixsocket-parent-2.0.4/junixsocket-native/target/junixsocket-native-2.0.4.jar
junixsocket-junixsocket-parent-2.0.4/junixsocket-native/target/nar/junixsocket-native-2.0.4-i386-Linux-gpp-jni/lib

Don't forget to include the MANIFEST.MF file.

This is what my merged 'junixsocket-native-common-2.0.4.jar' file contains...

lib/
lib/i386-Linux-gpp/
lib/i386-Linux-gpp/jni/
lib/i386-Linux-gpp/jni/history.xml
lib/i386-Linux-gpp/jni/libjunixsocket-native-2.0.4.so
META-INF/MANIFEST.MF
META-INF/maven/
META-INF/maven/com.kohlschutter.junixsocket/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/pom.properties
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native-common/pom.xml
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native/pom.properties
META-INF/maven/com.kohlschutter.junixsocket/junixsocket-native/pom.xml
META-INF/nar/
META-INF/nar/com.kohlschutter.junixsocket/
META-INF/nar/com.kohlschutter.junixsocket/junixsocket-native/
META-INF/nar/com.kohlschutter.junixsocket/junixsocket-native/nar.properties
org/
org/newsclub/
org/newsclub/net/
org/newsclub/net/jni/
org/newsclub/net/jni/DummyClass.class
org/newsclub/net/unix/
org/newsclub/net/unix/NarSystem.class
  • [ ] replace '[your.home.dir]/.vscode/extensions/redhat.java-0.3.0/server/config_linux/org.eclipse.osgi/45/0/.cp/lib/junixsocket-native-common-2.0.4.jar' with the one you just built from the contents of all those other things.

  • [ ] replace '[your.home.dir]/.vscode/extensions/redhat.java-0.3.0/server/config_linux/org.eclipse.osgi/45/0/.cp/lib/junixsocket-common-2.0.4.jar' with the one you built with maven '[junixsocket-junixsocket-parent-2.0.4/junixsocket-common/target/junixsocket-common-2.0.4.jar]'

Phewwww! What a faff just to install an IDE! That says a lot about Microsoft's commitment to *nix support. Ay?

limey-git avatar May 05 '17 08:05 limey-git

Discussion about 32bits junixsocket moved to #201

fbricon avatar May 05 '17 13:05 fbricon

I just installed VSCode v. 1.12.2 and "Language Support for Java(TM) by Red Hat" plugin v. 0.4.0. I have the same error "Couldn't start client Language Support for Java". I set up java.home parameter in VSCode. This does not solve the problem. I set up JAVA_HOME Windows variable to same folder. This does not solve the problem, too. I deleted java.home setting from VSCode. And here's a miracle! Everything worked. So, we have a problem with incorrect work java.home inside plugin.

igor-kudryashov avatar May 16 '17 12:05 igor-kudryashov

@igor-kudryashov can you please enable logging so we can understand what's happening?

fbricon avatar May 16 '17 12:05 fbricon

@fbricon I'm sorry, I can not repeat this error. I guess I did something wrong before.

igor-kudryashov avatar May 16 '17 15:05 igor-kudryashov

I eventually got this working in Windows with the following in vscode:

"java.home": '"C:\Program Files\Java\jdk1.8.0_131"'

NOTES:

  1. Double back-slashes
  2. Single quotes around the double-quotes (because the path has spaces).

HTH

simonl65 avatar Jun 02 '17 15:06 simonl65

I recently started having this problem as well on Ubuntu. This is the Java error that I get from the error log:

!ENTRY org.eclipse.osgi 4 0 2017-08-03 16:43:44.686
!MESSAGE Application error
!STACK 1
org.eclipse.core.runtime.CoreException: Plug-in org.eclipse.jdt.ls.core was unable to load class org.eclipse.jdt.ls.core.internal.LanguageServer.
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.throwException(RegistryStrategyOSGI.java:194)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:176)
	at org.eclipse.core.internal.registry.ExtensionRegistry.createExecutableExtension(ExtensionRegistry.java:905)
	at org.eclipse.core.internal.registry.ConfigurationElement.createExecutableExtension(ConfigurationElement.java:243)
	at org.eclipse.core.internal.registry.ConfigurationElementHandle.createExecutableExtension(ConfigurationElementHandle.java:55)
	at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:191)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.runApplication(EclipseAppLauncher.java:134)
	at org.eclipse.core.runtime.internal.adaptor.EclipseAppLauncher.start(EclipseAppLauncher.java:104)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:388)
	at org.eclipse.core.runtime.adaptor.EclipseStarter.run(EclipseStarter.java:243)
	at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
	at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
	at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
	at java.lang.reflect.Method.invoke(Method.java:498)
	at org.eclipse.equinox.launcher.Main.invokeFramework(Main.java:653)
	at org.eclipse.equinox.launcher.Main.basicRun(Main.java:590)
	at org.eclipse.equinox.launcher.Main.run(Main.java:1499)
	at org.eclipse.equinox.launcher.Main.main(Main.java:1472)
Caused by: java.lang.ClassNotFoundException: An error occurred while automatically activating bundle org.eclipse.jdt.ls.core (47).
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:112)
	at org.eclipse.osgi.internal.loader.classpath.ClasspathManager.findLocalClass(ClasspathManager.java:529)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.findLocalClass(ModuleClassLoader.java:328)
	at org.eclipse.osgi.internal.loader.BundleLoader.findLocalClass(BundleLoader.java:368)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClassInternal(BundleLoader.java:446)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:395)
	at org.eclipse.osgi.internal.loader.BundleLoader.findClass(BundleLoader.java:387)
	at org.eclipse.osgi.internal.loader.ModuleClassLoader.loadClass(ModuleClassLoader.java:150)
	at java.lang.ClassLoader.loadClass(ClassLoader.java:357)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.loadClass(EquinoxBundle.java:564)
	at org.eclipse.core.internal.registry.osgi.RegistryStrategyOSGI.createExecutableExtension(RegistryStrategyOSGI.java:174)
	... 16 more
Caused by: org.osgi.framework.BundleException: Exception in org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin.start() of bundle org.eclipse.jdt.ls.core.
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:800)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.start(BundleContextImpl.java:729)
	at org.eclipse.osgi.internal.framework.EquinoxBundle.startWorker0(EquinoxBundle.java:933)
	at org.eclipse.osgi.internal.framework.EquinoxBundle$EquinoxModule.startWorker(EquinoxBundle.java:309)
	at org.eclipse.osgi.container.Module.doStart(Module.java:581)
	at org.eclipse.osgi.container.Module.start(Module.java:449)
	at org.eclipse.osgi.framework.util.SecureAction.start(SecureAction.java:468)
	at org.eclipse.osgi.internal.hooks.EclipseLazyStarter.postFindLocalClass(EclipseLazyStarter.java:103)
	... 26 more
Caused by: java.lang.NoClassDefFoundError: org/eclipse/jdt/core/JavaCore
	at org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager.initialize(PreferenceManager.java:52)
	at org.eclipse.jdt.ls.core.internal.preferences.PreferenceManager.<init>(PreferenceManager.java:43)
	at org.eclipse.jdt.ls.core.internal.JavaLanguageServerPlugin.start(JavaLanguageServerPlugin.java:101)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:779)
	at org.eclipse.osgi.internal.framework.BundleContextImpl$3.run(BundleContextImpl.java:1)
	at java.security.AccessController.doPrivileged(Native Method)
	at org.eclipse.osgi.internal.framework.BundleContextImpl.startActivator(BundleContextImpl.java:772)
	... 33 more

I double check my jdk installation and that seems to be correct. I've also tried the JAVA_HOME fix, but looking at the above error I think it might be something different. I should also note that I did recently update my jdk to 1.8.0_131, so maybe that might have borked something?

cwainner avatar Aug 03 '17 23:08 cwainner

That kind of NoClassDefFoundError is typical of OSGi bundle failing to load. Possibly, your workspace got borked. I suggest cleaning it up and trying again

fbricon avatar Aug 04 '17 02:08 fbricon

@fbricon That did the trick. Thank you!

cwainner avatar Aug 04 '17 15:08 cwainner

I'm facing the same issue, Starting client failed, and i tried to fix like @simonl65 did, but with no luck on that. Any help here?

SO: Windows 10 64bits, my jdk is here -> C:\Program Files\Java\jdk1.8.0_131, when run "javac" on cmd it works fine.

feRpump avatar Aug 15 '17 15:08 feRpump

@feRpump Can you retrieve the server logs? Also can you check your .settings for any java related values? Troubleshooting section on wiki can help you locate the logs.

gorkem avatar Aug 15 '17 16:08 gorkem

@gorkem Here we go. The error in log says: [Extension Host] rejected promise not handled within 1 second t.logExtensionHostMessage @ /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29 /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29 The java.home variable defined in VS Code settings points to a missing folder e.onUnexpectedError @ /C:/Program Files (x86)/Microsoft VS Code/resources/app/out/vs/workbench/workbench.main.js:29 I think my settings are these: // Place your settings in this file to overwrite the default settings { "editor.fontFamily": "Fira Code", "editor.fontSize": 16, "editor.fontLigatures": true, "workbench.colorTheme": "Panda Syntax", "java.home": '"C:\Program Files\Java\jdk1.8.0_131"' } Please, correct me if i'm wrong!

feRpump avatar Aug 15 '17 17:08 feRpump

It looks like it does not like the java.home settings The java.home variable defined in VS Code settings points to a missing folder. Can you check what happens if you remove the java.home from settings

gorkem avatar Aug 15 '17 17:08 gorkem

Well, looks like the error is gone now... I tried this before but with no luck. So, can I compile standalone java files ? Like using javac ? If is, how can I do so?

feRpump avatar Aug 15 '17 17:08 feRpump

The Extension Host logs this for me:

[Extension Host] Executing /Library/Java/Home/bin/java -Declipse.application=org.eclipse.jdt.ls.core.id1 -Dosgi.bundles.defaultStartLevel=4 -Declipse.product=org.eclipse.jdt.ls.core.product -noverify -Xmx1G -XX:+UseG1GC -XX:+UseStringDeduplication -jar /Users/ln/.vscode/extensions/redhat.java-0.8.0/server/plugins/org.eclipse.equinox.launcher_1.4.0.v20161219-1356.jar -configuration /Users/ln/.vscode/extensions/redhat.java-0.8.0/server/config_mac -data /Users/ln/Library/Application Support/Code/User/workspaceStorage/0b093bbdf7d9c58c81e4cc08cf217a58/redhat.java/jdt_ws

(One thing that caught my eye is that the Application Support path is not quoted. Maybe it's only like that in the log output though.)

If I run that command manually, I get the same exit code 13 and no log output.

I deleted the directory specified as -data and it now launches again.

rm -rf '/Users/ln/Library/Application Support/Code/User/workspaceStorage/0b093bbdf7d9c58c81e4cc08cf217a58/redhat.java/jdt_ws'

java version "1.8.0_131"
Java(TM) SE Runtime Environment (build 1.8.0_131-b11)
Java HotSpot(TM) 64-Bit Server VM (build 25.131-b11, mixed mode)

chilloutman avatar Aug 18 '17 09:08 chilloutman

In windows 10,I edit the file setting.json in C:\Users\adminstrator\AppData\Roaming\Code\User,and it did work.The content from { "workbench.colorTheme": "Monokai Dimmed", "window.zoomLevel": 0, "window.menuBarVisibility": "default", "workbench.activityBar.visible": true, "workbench.sideBar.location": "left" } to { "workbench.colorTheme": "Monokai Dimmed", "window.zoomLevel": 0, "window.menuBarVisibility": "default", "workbench.activityBar.visible": true, "java.home": "C:\Program Files\Java\jdk1.8.0_144", "workbench.sideBar.location": "left" }

zzyykk123456 avatar Aug 18 '17 10:08 zzyykk123456

If you're not getting error code 13-visible in the VS Code Console-your problem is a different one.

chilloutman avatar Aug 18 '17 13:08 chilloutman

I'm closing this since most of the issues seemed resolved, and because since vscode-java 1.2.0, we provide an embedded Java runtime for many popular platforms.

rgrunber avatar Feb 02 '22 17:02 rgrunber