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

I'm with the same problem of @atang0404. But i'm using linux mint. I did set JAVA_HOME both ways, on linux and on vscode, but it doesn't work. [Error - 21:43:35] Starting client failed 13

fernandocangussu avatar Oct 22 '16 00:10 fernandocangussu

@atang0404 @fernandocangussu can you try the new 0.0.6 release. I only had a fedora to test but I think your issue may be resolved now.

gorkem avatar Nov 01 '16 20:11 gorkem

Nothing here. I updated vscode and the extension, but the problem continues.

fernandocangussu avatar Nov 03 '16 19:11 fernandocangussu

I'm somewhat new to this and learning. Would anyone be kind enough to briefly explain how I get to the JAVA_HOME part to add my install path of the JDK? I can create a launch.json file but it gives me several choices and I'm not sure which I'm supposed to be choosing. Any help for a beginner would be much appreciated. I am currently a programming student but I've never had to set things up like this before. I have gotten some working like PHP, C#, JavaScript... This ones proving difficult! In the end, I am trying to open a .java file by itself so I know that it shouldn't work, I'm only trying to get up to speed on the JAVA_HOME. Thanks in advance.

Oh and I do have eclipse projects that I have made from a Java class so if I could figure out the JAVA_HOME thing, then I should be able to debug those eclipse projects...

DanJ210 avatar Nov 07 '16 01:11 DanJ210

Hi, I picked up the output of /usr/libexec/java_home and set "java.home": "/Library/Java/JavaVirtualMachines/jdk1.8.0_111.jdk/Contents/Home" in javaconfig.json setting.json

Still I get the error that java.home is not set right.

I have tried: a) uninstalling and reinstalling Java Extension b) several restarts of VS Code c) I keep getting thums down with no log :(! d) Java server is not able to start on the client. I have no clue how to fix it after searching for solutions on the web.

Environment: Mac OS X 10.11.6 | VS Code 1.7.1 | RedHat extension downloaded and applied on Nov 15th.

For the solution, I want clear instructions and samples - I find documentation rather hard to follow since there are very few examples on how the changes look in a real system.

Thanks for this! I enjoy working with VS Code and so would like to use for Java projects too.

Regards, Yuva

YuvaAthur avatar Nov 16 '16 05:11 YuvaAthur

@YuvaAthur thumbsdown usually means that your server is working but your project can not be recognized. Are you using a maven based project? The currently released version only supports maven.

We are aware that we are thin on documentation at the moment. We have started to write some, it is very early work but may help.

gorkem avatar Nov 16 '16 14:11 gorkem

Quite like VSCode... installed it for my NodeJS projects -- and quite impressed. Works very well including the NodeJS debugging. Thought I'd try it out for Java.

It works.. but need to be able to define a build path a la Eclipse etc... We don't use Maven ... Doesn't look like that is supported? So looks like I'm stuck with Eclipse.. not a bad thing.. just prefer the Editor and speed of VSCode.

jamesskyoung avatar Nov 21 '16 21:11 jamesskyoung

@gorkem - Thanks! I created a maven project in Eclipse and used it in VS Code. I got a ThumbsUp! Yay!

Now, eclipse has a simple pom.xml and a detailed pom.xml that is generated on the fly. What level of detail does VS Code Java project expect?

(BTW, the project is not compiling in eclipse - there are other issues to fix. I am working on it. Once I can get the project to compile, I shall test it in VS Code.)

YuvaAthur avatar Nov 21 '16 21:11 YuvaAthur

@YuvaAthur You do not need to have anything special on pom.xml for this extension. If you have a thumbs up that means the extension is able to recognize your project.

gorkem avatar Nov 21 '16 21:11 gorkem

Ubuntu 14.04 Version 1.9.1 Commit f9d0c687ff2ea7aabd85fb9a43129117c0ecf519 Date 2017-02-08T23:29:12.221Z Shell 1.4.6 Renderer 53.0.2785.143 Node 6.5.0

I am getting error after "Completing Java Installation" Error occurs "Couldn't start client Language Support for Java". The config_linux directory includes a log with exception:

!SESSION 2017-02-13 09:23:33.173 ----------------------------------------------- eclipse.buildId=unknown java.version=1.8.0_121 java.vendor=Oracle Corporation BootLoader constants: OS=linux, ARCH=x86, WS=gtk, NL=en_US Command-line arguments: -data /home/ryanstinson/.config/Code/User/workspaceStorage/bc293bac07e5fda7793c38d73e44e662/redhat.java/jdt_ws

!ENTRY org.eclipse.osgi 4 0 2017-02-13 09:23:34.216 !MESSAGE Application error !STACK 1 java.lang.ExceptionInInitializerError at org.newsclub.net.unix.AFUNIXSocket.(AFUNIXSocket.java:36) at org.newsclub.net.unix.AFUNIXSocket.newInstance(AFUNIXSocket.java:54) at org.jboss.tools.vscode.java.internal.ConnectionStreamFactory$NamedPipeStreamProvider.getInputStream(ConnectionStreamFactory.java:56) at org.jboss.tools.vscode.java.internal.ConnectionStreamFactory.getInputStream(ConnectionStreamFactory.java:138) at org.jboss.tools.vscode.java.internal.JavaLanguageServerPlugin.startConnection(JavaLanguageServerPlugin.java:64) at org.jboss.tools.vscode.java.internal.JavaLanguageServerPlugin.startLanguageServer(JavaLanguageServerPlugin.java:117) at org.jboss.tools.vscode.java.internal.LanguageServer.start(LanguageServer.java:26) at org.eclipse.equinox.internal.app.EclipseAppHandle.run(EclipseAppHandle.java:196) 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.IllegalStateException: java.lang.reflect.InvocationTargetException at org.newsclub.net.unix.NativeUnixSocket.(NativeUnixSocket.java:42) ... 20 more Caused by: java.lang.reflect.InvocationTargetException 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.newsclub.net.unix.NativeUnixSocket.(NativeUnixSocket.java:35) ... 20 more Caused by: java.lang.RuntimeException: Library 'libjunixsocket-native-2.0.4.so' not found! at org.newsclub.net.unix.NarSystem.getLibPath(NarSystem.java:132) at org.newsclub.net.unix.NarSystem.loadLibrary(NarSystem.java:36) ... 25 more

ryanstinson avatar Feb 13 '17 17:02 ryanstinson

Seems you need to install the native JNI libraries 1st. https://code.google.com/archive/p/junixsocket/wikis/GettingStarted.wiki.

For me, it works OOTB on ubuntu 16.10

fbricon avatar Feb 13 '17 17:02 fbricon

Thanks @fbricon - It seems the libs at that link are 1.x and the extension is looking for 2.0.4.

I don't see anyway to get the "libjunixsocket-native-2.0.4.so" it is looking for. Any help would be greatly appreciated.

ryanstinson avatar Feb 13 '17 18:02 ryanstinson

I don't know the answer to that, maybe @kohlschuetter can help?

fbricon avatar Feb 13 '17 18:02 fbricon

I was able to get the lib installed from maven repo. ldconfig shows the lib:

libjunixsocket-native-2.0.4.so (libc6,x86-64) => /usr/lib/libjunixsocket-native-2.0.4.so

But still the same error persists. Any help at this point?

ryanstinson avatar Feb 13 '17 19:02 ryanstinson

After digging a bit more, I found that the junix jar files are installed along side the org.eclipse.osgi libs. So, for whatever reason, the 'native-lib-loader' package cannot load the jar file and its embedded libjunixsocket-native-2.0.4.so library.

ryanstinson avatar Feb 13 '17 21:02 ryanstinson

@kohlschuetter any ideas?

ryanstinson avatar Feb 17 '17 21:02 ryanstinson

I got the "Couldn't start client Language Support for Java" error on my Windows OS. I've followed all the steps in this discussion.

In Visual Studio Code "java.home": "C:\Progra~1\Java\jdk1.8.0_121" OR "java.home": "C:\Program Files\Java\jdk1.8.0_121"

In System: JAVA_HOME=C:\Program Files\Java\jdk1.8.0_121

I am using Visual Studio Code in Windows 10 partition on my Mac Pro machine.

Is there any debug log from this extension to check what the actual problem is?

kamtungc avatar Feb 22 '17 17:02 kamtungc

In the vs code extension directory "%USERPROFILE%.vscode\extensions" on windows, navigate to the red hat plugin/config_windows/server directory. Within that directory will be any logs associated with starting the plugin.

ryanstinson avatar Feb 22 '17 18:02 ryanstinson

I have .vscode\extensions\redhat.java-0.0.10\server\config_win\config.ini only.

And, finally, I found the issue. It looks like the extension could not start correctly because of "java.jdt.ls.vmargs". "lombok.jar" is not correct. Now I can start the extension! Thanks!

"java.home": "c:\\Program Files\\Java\\jdk1.8.0_121",
"java.jdt.ls.vmargs": "-javaagent:C:\\codes\\libs\\java\\lombok.jar -Xbootclasspath/a:C:\\codes\\libs\\java\\lombok.jar"

I just followed https://github.com/redhat-developer/vscode-java/wiki/Lombok-support to add lombok.jar.

kamtungc avatar Feb 22 '17 22:02 kamtungc

I'm also experiencing the libjunixsocket-native-2.0.4.so issue. I extracted the .so from the jar, checked dependencies:

$ ldd libjunixsocket-native-2.0.4.so 
        linux-vdso.so.1 =>  (0x00007ffd1b4ce000)
	libstdc++.so.6 => /usr/lib/x86_64-linux-gnu/libstdc++.so.6 (0x00007fc34d71d000)
	libm.so.6 => /lib/x86_64-linux-gnu/libm.so.6 (0x00007fc34d417000)
	libgcc_s.so.1 => /lib/x86_64-linux-gnu/libgcc_s.so.1 (0x00007fc34d201000)
	libc.so.6 => /lib/x86_64-linux-gnu/libc.so.6 (0x00007fc34ce39000)
	/lib64/ld-linux-x86-64.so.2 (0x00007fc34dc25000)

All of those exist on the system. In my case the specific error is a little different:

Caused by: java.lang.UnsatisfiedLinkError: /tmp/libjunixsocket-native-2.0.42440132215440112994.so: /tmp/libjunixsocket-native-2.0.42440132215440112994.so: failed to map segment from shared object: Operation not permitted

This is on an older version of ubuntu 14.04 (reasons...). My thought is there there may be reasons that the .so can't be loaded out of /tmp/ due to some mount restrictions on /tmp. I can't exec a shell script in /tmp for example. It's not mounted noexec though:

$ mount
...
/tmp on /var/tmp type none (rw,bind)

Any thoughts?

UPDATE: This did turn out to be a mount issue. I have a bind mount point for tmp, and the original mount point was noexec, removing that from fstab fixes the issue. I did look for an alternate way to change the tmp dir, but that wasn't obvious.

bluejekyll avatar Apr 11 '17 01:04 bluejekyll