VS code setup for Java remote development

942 Views Asked by At

few weeks back vscode made JDK-11 mandatory for java development in VS-code

The Eclipse Platform has decided to require Java 11 as the minimum requirement for its September 2020 release. See https://www.eclipse.org/lists/eclipse-pmc/msg03821.html.

Because vscode-java depends on the Eclipse JDT.LS, the same requirement applies to vscode-java but on a more agressive timeline: vscode-java usually consumes JDT.LS builds that depend on bleeding edge JDT features, effectively shipping pre-release versions of Eclipse Platform/JDT. As of July 22nd, 2020, Java 11 is now required for running vscode-java. 

source: vscode

i am using remote ssh extension to connect to my remote VM (ubuntu on vagrant). when i open Java file in remote-ssh ,i am getting error saying install Java 11.

i have the java 11 already in my vagrant.

i can see the following in my VM

$ update-java-alternatives -l
java-1.11.0-openjdk-amd64      1111       /usr/lib/jvm/java-1.11.0-openjdk-amd64
java-1.8.0-openjdk-amd64       1081       /usr/lib/jvm/java-1.8.0-openjdk-amd64


vagrant@vagrant:/usr/lib/jvm
$ ls
total 24K
drwxr-xr-x   4 root root 4.0K Feb 21  2020 .
drwxr-xr-x 138 root root 4.0K Aug 13 17:57 ..
lrwxrwxrwx   1 root root   25 Feb 20  2019 default-java -> java-1.11.0-openjdk-amd64
lrwxrwxrwx   1 root root   21 Jan 15  2020 java-1.11.0-openjdk-amd64 -> java-11-openjdk-amd64
-rw-r--r--   1 root root 2.0K Jan 15  2020 .java-1.11.0-openjdk-amd64.jinfo
drwxr-xr-x   7 root root 4.0K Feb 21  2020 java-11-openjdk-amd64
lrwxrwxrwx   1 root root   20 Jan 17  2020 java-1.8.0-openjdk-amd64 -> java-8-openjdk-amd64
-rw-r--r--   1 root root 2.7K Jan 17  2020 .java-1.8.0-openjdk-amd64.jinfo
drwxr-xr-x   7 root root 4.0K Feb 21  2020 java-8-openjdk-amd64

all my java projects depends on java-8 so just to work with in vscode , i need Java-11.

please help me to setup this Env.

1

There are 1 best solutions below

0
On

The easiest is to change your java config with the following command:

sudo alternatives --config java

and choose the Java version you want active.