You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
@DisabledForJreRange and @EnabledForJreRange using source target rather what java version being used #1758
Hi Max Rydahl Andersen (@maxandersen), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
Here are some ways to force VS Code to pick up your real Java 17 runtime instead of using the source/target values:
• Configure Gradle’s JVM in VS Code settings so import (and the Test Runner) use JDK 17:
This makes VS Code launch Gradle (and thus the tests) with your Java 17 installation.
• Use java.configuration.runtimes to map the “JavaSE-17” runtime to your JDK 17:
Then run the Java: Configure Java Runtime command and ensure your project uses the “JavaSE-17” entry.
• If you’re on Gradle toolchains, also add to build.gradle:
and make sure your VS Code Java Extension is up-to-date (≥1.22) so it supports Gradle toolchains properly.
High-confidence reference:
• “Java Runtime incorrect, when using gradle toolchains” redhat-developer/vscode-java#2804 Extension shows wrong Java version (12) despite toolchain=17 – same root cause of wrong JRE detection.
Other references with low confidence
• “java has been set to 11 as default” redhat-developer/vscode-java#3136 VS Code defaults to Java 11 for import even when sourceCompatibility=17 – suggests configuring java.configuration.runtimes.
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!
Activity
github-actions commentedon Nov 13, 2025
Hi Max Rydahl Andersen (@maxandersen), I'm an AI Support assistant here to help with your issue. While the team reviews your request, I wanted to provide some possible tips and documentation that might help you in the meantime.
Here are some ways to force VS Code to pick up your real Java 17 runtime instead of using the source/target values:
• Configure Gradle’s JVM in VS Code settings so import (and the Test Runner) use JDK 17:
This makes VS Code launch Gradle (and thus the tests) with your Java 17 installation.
• Use java.configuration.runtimes to map the “JavaSE-17” runtime to your JDK 17:
Then run the Java: Configure Java Runtime command and ensure your project uses the “JavaSE-17” entry.
• If you’re on Gradle toolchains, also add to build.gradle:
java { toolchain { languageVersion = JavaLanguageVersion.of(17) } }and make sure your VS Code Java Extension is up-to-date (≥1.22) so it supports Gradle toolchains properly.
High-confidence reference:
• “Java Runtime incorrect, when using gradle toolchains”
redhat-developer/vscode-java#2804
Extension shows wrong Java version (12) despite toolchain=17 – same root cause of wrong JRE detection.
Other references with low confidence
• “java has been set to 11 as default”
redhat-developer/vscode-java#3136
VS Code defaults to Java 11 for import even when sourceCompatibility=17 – suggests configuring java.configuration.runtimes.
The team will respond to your issue shortly. I hope these suggestions are helpful in the meantime. If this comment helped you, please give it a 👍. If the suggestion was not helpful or incorrect, please give it a 👎. Your feedback helps us improve!