feat: Add comprehensive Java auto-detection#9
Closed
quinnjr wants to merge 2 commits into
Closed
Conversation
284ccdf to
e3be66a
Compare
e3be66a to
960595d
Compare
Replace SConstruct's inline JAVA_HOME/javac probe with a build_support helper that handles JDK detection across platforms: - Check JAVA_HOME env var, fall back to resolving javac on PATH - Search platform-specific install paths (Linux/macOS/Windows) - Honor RHEL/CentOS /etc/alternatives/java_sdk symlink - Match the java-X-openjdk-VERSION dir layout (with arch suffix) - When javac resolves to a JRE, walk up to find the matching JDK - Configure JNI include paths (jni.h + jni_md.h in platform subdir) - Locate libjvm in lib/server (HotSpot) or lib (older layouts) - Surface a clear "install <distro>-devel" hint when JNI is missing The old inline detection in SConstruct hardcoded a RHEL 8 JDK path and assumed a single layout, so anything outside that exact setup silently fell back to "no Java." The new detector returns a JavaConfig dataclass so SConstruct just consults .is_valid / .include_paths / .lib_paths and registers HAVE_JAVA when the JDK is real.
9108298 to
285fdcd
Compare
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.
Summary
Changes
New
detect_java_config()Function inbuild_support.pyMulti-step detection strategy:
JAVA_HOMEenvironment variablejavacexecutable and derive JAVA_HOME from it/usr/lib/jvm/*,/usr/java/*,/opt/java/*/Library/Java/JavaVirtualMachines/*, Homebrew locationsC:/Program Files/Java/*, Eclipse Adoptium, Microsoft JDKJavaConfigClassHolds detection results:
java_home: Path to JDK installationinclude_paths: JNI header directorieslib_paths: Library directorieslibjvm_path: Path to libjvm shared libraryis_valid: Whether detection succeededversion: Detected Java versionSConstruct Updates
--without-javadefault toFalse(enable auto-detection)detect_java_config()for robust detectionlibjvmTest plan