fix(windows): use JAVA_HOME when java is not on PATH#8656
Open
mohan485 wants to merge 2 commits into
Open
Conversation
chadlwilson
approved these changes
Jul 12, 2026
Contributor
There was a problem hiding this comment.
Pull request overview
Updates the Windows CLI launcher template to locate java.exe via JAVA_HOME when JAVACMD is not set, addressing Windows environments where Java isn’t on PATH (Fixes #8631).
Changes:
- Add a
JAVA_HOME-based lookup for%JAVA_HOME%\bin\java.exewhenJAVACMDis empty. - Preserve existing fallback behavior to the default Java executable when
JAVA_HOMEdoes not providejava.exe.
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Co-authored-by: Copilot Autofix powered by AI <175728472+Copilot@users.noreply.github.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description of Change
Updated the Windows launcher template to use JAVA_HOME to locate the Java executable when JAVACMD is not set. If %JAVA_HOME%\bin\java.exe exists, it is used; otherwise, the launcher falls back to the default Java executable (java) on the system PATH.
This change allows the Dependency-Check CLI to run on Windows when JAVA_HOME is configured but java.exe is not present on the PATH, while preserving the existing behavior for users who set JAVACMD or rely on PATH.
Related issues
Fixes #8631
This fixes issue #8631, where the CLI fails on Windows if JAVA_HOME is configured but java.exe is not on PATH.
Have test cases been added to cover the new functionality?
This change updates the Windows launcher script only. The behavior was verified manually by testing the following scenarios:
JAVA_HOME configured and java.exe not on PATH → CLI starts successfully.
JAVACMD configured → launcher uses JAVACMD.
JAVA_HOME not configured but java.exe available on PATH → existing behavior is preserved.