Conversation
There was a problem hiding this comment.
Why do we need this file? Is there any connection between bash and java🤔
There was a problem hiding this comment.
Why do we need this file? Is there any connection between bash and java🤔
看起来是 AI 生成的内容。
zkitefly and Glavo both questioned why a Java test drives the bash launcher script. The harness does not belong in this PR; the SDKMAN discovery fix in HMCLauncher.sh stands on its own.
|
You're both right — there's no good reason for a Java test to drive the bash launcher, and the file shouldn't have been in this PR. I've dropped it in e16dc10. What's left is the 16 lines in HMCLauncher.sh: check SDKMAN_CANDIDATES_DIR, then SDKMAN_DIR/candidates, then ~/.sdkman/candidates, and exec that java if it's executable. It follows the same shape as the javavm branch just above it and doesn't source any shell startup files. Happy to drop the whole PR if you'd rather not carry SDKMAN handling in the launcher at all. |
Add a Linux/macOS fallback directly to HMCLauncher.sh after the existing lookup branches and before the Java-not-found warning, resolving SDKMAN's selected
candidates/java/current/bin/javafrom a nonempty SDKMAN_DIR or, when unset/empty, a nonempty HOME plus.sdkman. The reporter cannot start HMCL-3.6.18.297.sh on Ubuntu 25.04 after installing Java through SDKMAN, with both Dragonwell 21 and Liberica 25 reported affected.Reproduce the missing branch on Linux with JAVA_HOME and HMCL_JAVA_HOME absent and a controlled PATH containing only the bootstrap's required non-Java utilities: a temporary
.sdkman/candidates/java/currentsymlink targets an executable stub, and startup selects it successfully; establish that the existing script fails this scenario before the fix; Verify custom SDKMAN_DIR and SDKMAN_CANDIDATES_DIR roots, including spaces in the root and launcher filename; empty SDKMAN variables fall back appropriately, while an absent/empty HOME must never trigger a relative lookup in the working directory.Closes #4574