claude-code - 💡(How to fix) Fix [BUG] Claude Code execution environment uses JDK 17, blocking compilation for Java 21+ projects [1 comments, 2 participants]

Official PRs (…)
ON THIS PAGE

Recommended Tools

×6

Utilities matched from this issue’s tags and category — try them while you read without losing context.

GitHub issue graph ai analysis

Paste a GitHub issue URL. We fetch that issue, discover linked issues from bodies/comments/timeline, collect linked pull requests, and produce a structured English report.

The report is written in English Markdown for sharing and archival.

Helpful · Quick feedback

Loading…
GitHub stats
anthropics/claude-code#58676Fetched 2026-05-14 03:42:18
View on GitHub
Comments
1
Participants
2
Timeline
5
Reactions
0
Timeline (top)
labeled ×4commented ×1

Error Message

Error Messages/Logs

  1. Build fails with: error: invalid source release: 25

Code Example

Build fails. Claude cannot verify compilation correctness, catch type errors, or run tests on any project targeting Java > 17.
RAW_BUFFERClick to expand / collapse

Preflight Checklist

  • I have searched existing issues and this hasn't been reported yet
  • This is a single bug report (please file separate reports for different bugs)
  • I am using the latest version of Claude Code

What's Wrong?

Claude Code's shell environment only has JDK 17 available (java -version returns 17.0.12). This means any project targeting Java 21, 25 (LTS), or newer will fail to compile when Claude attempts to run Gradle or Maven build commands.

What Should Happen?

Claude Code's environment should ship with a recent JDK (ideally the current LTS — Java 25) so it can compile, test, and run Java projects without requiring the user to fall back to their local terminal.

Error Messages/Logs

Build fails. Claude cannot verify compilation correctness, catch type errors, or run tests on any project targeting Java > 17.

Steps to Reproduce

  1. Open a Java project with sourceCompatibility = JavaVersion.VERSION_25 (or 21+)
  2. Ask Claude to compile: ./gradlew build -x test
  3. Build fails with: error: invalid source release: 25

Claude Model

None

Is this a regression?

Yes, this worked in a previous version

Last Working Version

No response

Claude Code Version

2.1.140

Platform

Anthropic API

Operating System

Windows

Terminal/Shell

IntelliJ IDEA terminal

Additional Information

Environment:

  • OS: Windows 11
  • Claude Code version: 2.1.140
  • Project: Spring Boot 3.3 / Gradle 9.1.0, targeting Java 25

Vote matrix · Quick signals

Works
Did the solution work? Tap to confirm.
Easy Fix
Was it a quick fix?
Time Saver
Did it save you time?
Blocking
Was it severely blocking?
Common Issue
Are others likely hitting this too?
Flaky / Intermittent
Is it intermittent?
Verified / Reproducible
Can you reproduce it reliably?
Loading…

Still need to ship something?

×6

Another batch ranked right after the header list — different links, same matching logic.

Back to top recommendations

TRENDING

claude-code - 💡(How to fix) Fix [BUG] Claude Code execution environment uses JDK 17, blocking compilation for Java 21+ projects [1 comments, 2 participants]