I am trying to move to visual studio code from my Java work. I have the recommended extensions but I am getting strange errors like:
"The compiler compliance specified is 17 but a JRE 1.8 is used"
I do not have a JDK 17 installed (the project needs to be built with Java 8)
In my root pom.xml I have:
<properties>
<project.source>1.8</project.source>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
and in the project .vscode/settings.json:
{
"java.compile.nullAnalysis.mode": "automatic",
"java.jdt.ls.vmargs": "-XX:+UseParallelGC -XX:GCTimeRatio=4 -XX:AdaptiveSizePolicyWeight=90 -Dsun.zip.disableMemoryMapping=true -Xmx6G -Xms1G -Xlog:disable",
"java.configuration.updateBuildConfiguration": "automatic",
"java.configuration.runtimes": [
{
"default": true,
"name": "JavaSE-1.8",
"path": "/usr/local/sdkman/candidates/java/current",
}
],
"java.debug.settings.onBuildFailureProceed": true
}
And to validate this is a Java 8:
~ /usr/local/sdkman/candidates/java/current/bin/java -version
openjdk version "1.8.0_292"
OpenJDK Runtime Environment (Zulu 8.54.0.21-CA-linux64) (build 1.8.0_292-b10)
OpenJDK 64-Bit Server VM (Zulu 8.54.0.21-CA-linux64) (build 25.292-b10, mixed mode)
On the command line the project builds fine. Any idea what can be causing this?
1