redhat-developer / redhat-developer/vscode-java
Can not build gradle project with jdk 17
Nobody has claimed this yet.
- Dominant language
- TypeScript
- Stars
- 2.3k
- Forks
- 546
- Avg merge
- 20h 1m
- Merged PRs (30d)
- 11
Description
My project requires jdk 17 to build. I use jenv to manage jdk and I set it to use java 17 locally but it seems the extension always use 21 to build project. I can build the project successfully in the terminal. I think the extension should use the java configured in java_home to build the project.
java home:
echo $JDK_HOME
/Users/user/.jenv/versions/17
Error log:
[info] [gradle-server] Gradle Server started, listening on 52563
[info] Gradle client connected to server
[info] Java Home: /Users/user/.cursor/extensions/redhat.java-1.43.1-darwin-arm64/jre/21.0.7-macosx-aarch64
[info] JVM Args: --add-opens=java.base/java.util=ALL-UNNAMED,--add-opens=java.base/java.lang=ALL-UNNAMED,--add-opens=java.base/java.lang.invoke=ALL-UNNAMED,--add-opens=java.prefs/java.util.prefs=ALL-UNNAMED,--add-opens=java.base/java.nio.charset=ALL-UNNAMED,--add-opens=java.base/java.net=ALL-UNNAMED,--add-opens=java.base/java.util.concurrent.atomic=ALL-UNNAMED,-XX:MaxMetaspaceSize=256m,-XX:+HeapDumpOnOutOfMemoryError,-Xms256m,-Xmx512m,-Dfile.encoding=UTF-8,-Duser.country=CN,-Duser.language=en,-Duser.variant
[info] Gradle User Home: /Users/user/.gradle
[info] Gradle Version: 7.6.4
[error] FAILURE: Build failed with an exception.
I tried to add the config below but still not working
"java.configuration.runtimes": [
{
"name": "JavaSE-17",
"path": "/Users/user/.jenv/versions/17",
"default": true
}
],
"gradle.java.home": "/Users/user/.jenv/versions/17"
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start with the Gradle Server startup and Java Home handling shown in the error log, then trace how java.configuration.runtimes and gradle.java.home are read. Reproduce with jenv and JDK 17 while Gradle reports the bundled JDK 21; done means the project builds with the configured JDK 17.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- build-system, devtools
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100