All company projects I work for use Java 8. However I want to try working with VSCode for Java. The problem is that it asks me for Java 11 to make the Java extension work (plus I want to start doing personal projects with java 11).
Right now in the path (windows environment), I have java 8. If I put java 11 in the path, although it is supposed to be backward compatible, they have deprecated and removed many things so colleagues have told me that it will give many problems.
How can I work with java 8, java 11, and VSCode? What is the configuration that I must have in the path (Windows environment) and how can I configure VSCode so that each project works with its own SDK? I have looked at the documentation for VSCode, but I don't understand it very well.
One thing is your installed jdk, you can have many jdk installed 8,11,16... but it's suggested have jdk11+ installed for working well on vscode.
Except your installed jdk versions, each java project can have your own version java setted ( in pom.xml, in build.grable... )
After installed JDK11+ you can open your java project ( even on java8 version ) and choose both:
It's possible use jdk11 and working in project with Java 8
don't forget to install Extension Pack for Java ( vscjava.vscode-java-pack )
on vscode
press CTRL + SHIFT + P
and search for 'configure java runtime'
you will got 3 tabs to set:
Clean your workspace after change settings
press CTRL + SHIFT + P
and search for 'Clean java Language'. Vscode will be reseted and refreshed