Code-server: Java Extension Pack installs but does not work properly

Created on 5 Apr 2019  路  19Comments  路  Source: cdr/code-server

Description

When opening a Java file after installing the Java Extension Pack, the syntax highlighting works, but nothing else does - I don't get the rocket as described on https://code.visualstudio.com/docs/java/java-tutorial.

I have verified that the same setup works on desktop (Linux) VS Code.

I have installed OpenJDK 11 inside the coder container.

Steps to Reproduce

  1. Install the Java Extension Pack from the marketplace
  2. Try opening any Java file. See that no syntax errors or info is shown.
bug

Most helpful comment

Will fix. Thanks for the report!

All 19 comments

@foresthoffman

Will fix. Thanks for the report!

I've tried similar things.

Of possible note, installing the Java Extension Pack on native VS Code also installs other extensions named in the pack; I notice that neither my coder.com instance nor my self-hosted show that the following are installed:

Unfortunately even after installing those (and OpenJDK 11, and maven) I'm unable to get any of the Java features to work.

same issue here - cannot get that pack to work

i was able to start, debug & run tests a spring app...
have a look at this Dockerfile: https://github.com/monostream/code-server/blob/develop/Dockerfile

the extension is installed before code-server starts - maybe this is the key that this puppy works.

else, try to open the command prompt (Keyboard Shortcut: 鈬р寴P (Windows, Linux Ctrl+Shift+P)) and type Reload Window (vscode restarts and the extenions are reloaded/installed)

Hi @adrianliechti - thanks for sharing this impressive Dockerfile! cool work! I will give it a try later.

I have the RedHat Java extension installed her:
/root/.local/share/code-server/extensions/redhat.java-0.43.0/
[yes, I run code-server as root - this is for testing this "new way" of developing on an internal VM]

And I restart code-server every day so that cannot be the root cause as well.

I tried to run code-server as a non-root user. I had to re-install the Java extension pack, I stopped code-server, restarted, logged in again but still it doesn't work. To tell whether it works or not I did two simple tests within an existing (and working) Java source code file:

  1. Try to see if code completion works by typing this(dot) --> nothing happens, the code editor doesn't show the available properties of that class
  2. Try to see if syntax errors are shown - they are not. Even when I do a mvn install and maven shows compilation errors, they are not shown by the editor within the java file.

My JAVA_HOME is set to /usr/lib/jvm/java-8-openjdk-amd64 which should be correct. I did not edit any vscode settings like java.home.

13532D52-4E2D-4E7D-9BA0-CCB58404F606

I tried the same (on my ipad...) and as you see, code completion and syntax errors are shown... strange.

(ubuntu, java 10, extensions from official marketplace)

I see this error when I connect to code-server using my browser:

ERROR SHARED stderr {"data":"Uncaught Exception: Error: ENOENT: no such file or directory, open '/home/kurt/.local/share/code-server/Backups/workspaces.json'\n\nError: ENOENT: no such file or directory, open '/home/kurt/.local/share/code-server/Backups/workspaces.json'\n at Timeout.setTimeout [as _onTimeout] (/home/travis/build/codercom/code-server/packages/server/build/bootstrap-fork.js.gz:52540:31)\n at ontimeout (timers.js:498:11)\n at tryOnTimeout (timers.js:323:5)\n at Timer.listOnTimeout (timers.js:290:5)\n"}

not sure if this has anything to do with this

@ksemba The workspaces.json error is unrelated.

I did some experimenting with this using both the stock Coder image and the Dockerfile @adrianliechti posted above.
There seems to be a couple separate problems to make this all work.

  1. The extensions have to be installed before code-server is started.
  2. Installing the Java Extension Pack doesn't install all the related plugins, but installing each individually is fine.
  3. You have to have a recent up to date version of gradle/mvn/etc for the plugins to work correctly as well as make the Language Support for Java(TM) by Red Hat) plugin happy.

After installing the plugins manually as per the Dockerfile above, I was still not able to get code completion. However at this point I was getting errors from the Language Support for Java(TM) by Red Hat plugin. After solving these (in my case upgrading the gradle in my project from 2.4 to 5.1) I was able to get code completion.

Thanks @nyxcharon - manually installing the Java extension according to @adrianliechti 's Dockerfile and restarting code-server worked!! Thank you all!

I had try install both Java Extension Pack and Language Support for Java(TM) by Red Hat but it still do not work.
When I try any command and it shows command 'java.open.serverLog' not found
So, basically I cannot get anything work so far.
I am using version 1.792-vsc1.33.1

I ran into this issue also, and the above discussion pretty much points to the reason some work, some dont.

The specific plugins and order of install are not the issue, it appears to be installing from microsoft sources (aka @andrianliechti Dockerfile example) or from Coder's marketplace (using code-server --install-extension or the in-app marketplace)

My guess is something is off in the coder copy.

also, hats off to @andrianliechti awesome work on that Dockerfile! Definitely stealing some ideas there!

A follow up/me too:
the Java Extension pack (0.7.1) still fails to fully install the wrapped extensions (some parts are install, other pieces go missing). Even downloading the vsix for the extension pack doesn't fully install. Installing them singularly (via VSIX) appears to resolve the problem.

Is this particular to them being MS components, or the wrapping extension? Is there something I need to do on my side to enable this "custom marketplace", or is that there already by default?

re: some parts:
eg: vcsjava.vscode-java-dependency 0.4.0: some of the package is present in the extensions folder, but key pieces like "server/com.microsoft.jdtls.ext.core-0.4.0.jar" are not present. This presents itself in the LS log, stating it cannot find many things.

I had the same issue. I.e. just syntax highlighting and nothing else worked.
Eventually, I did Ctrl+Shif+P -> Java: Clean the Java language server workspace. Everything started working.
I have a project: simple main class with static main in subpackage + gradle wrapper + maven folders structure.

Hey all, try out v2 in Releases. I think we fixed this one.

@sr229 what exactly the solution here?

@reotam5 Explanation in GH-857. It seems someone reports the Java pack works fine at GH-961 now so I'll close this off as well.

Was this page helpful?
0 / 5 - 0 ratings

Related issues

justmao945 picture justmao945  路  3Comments

rcarmo picture rcarmo  路  3Comments

lshamis picture lshamis  路  3Comments

infogulch picture infogulch  路  3Comments

grant picture grant  路  3Comments