„Unbound classpath container: 'JRE System Library [JavaSE-11]' in project“ With JDK 12 Installed
See original GitHub issueVS Code reports classpath problems if a Gradle build script specifies source and target versions that are different from the Java version that’s installed:
x Unbound classpath container: 'JRE System Library [JavaSE-11]' in project 'jarexec.plugin'
x The project cannot be built until build path errors are resolved
Environment
- Operating System: Linux x64 4.15.0-47-generic snap
- JDK version: OpenJDK 64-Bit Server VM (build 12-ea+15, mixed mode, sharing)
- Visual Studio Code version: 1.33.1
- Java extension version: 0.43.0
Steps To Reproduce
-
Install JDK 12
-
In the
build.gradle
file of an existing Gradle project, add the following:sourceCompatibility = JavaVersion.VERSION_11
targetCompatibility = JavaVersion.VERSION_11
-
Launch VS Code from inside the directory of the existing Gradle project
[attach a sample project reproducing the error] attach logs
Current Result
Expected Result
0 Problems. Java does not require there to be an installed version of that specified in the source
and target
options. Java allows you to specify source
and target
versions that are lower than that of the installed version of Java that will be used to compile the target code.
Additional Informations
cc: @naco-siren
Issue Analytics
- State:
- Created 4 years ago
- Reactions:3
- Comments:5
Hey! Thanks @fbricon 👍
F1 | Java: Java Force Compilation | Full
did the trick. I also had to do aJava: Clean the Java language server workspace
because compilation didn’t seem to take for some reason. Mind you, I am on a super slow, low memory VM at the moment. So that’s gotta be giving vscode some trouble.Cheers.
Oddly enough, this particular setting doesn’t go into ./settings/org.eclipse.jdt.core.prefs but ./settings/org.eclipse.jdt.launching.prefs:
You’ll need to execute a full build for the compiler to apply the new settings: (
Java force compilation
>Full
command)