Skip to content

feat: Add comprehensive Java auto-detection#9

Open
quinnjr wants to merge 37 commits intoFIUBioRG:masterfrom
quinnjr:feature/java-auto-detection
Open

feat: Add comprehensive Java auto-detection#9
quinnjr wants to merge 37 commits intoFIUBioRG:masterfrom
quinnjr:feature/java-auto-detection

Conversation

@quinnjr
Copy link
Contributor

@quinnjr quinnjr commented Feb 3, 2026

Summary

  • Implement robust Java installation auto-detection
  • Enable Java plugin support by default when a JDK is detected
  • Support Linux, macOS, and Windows platforms

Changes

New detect_java_config() Function in build_support.py

Multi-step detection strategy:

  1. Check JAVA_HOME environment variable
  2. Find javac executable and derive JAVA_HOME from it
  3. Search common installation directories by platform:
    • Linux: /usr/lib/jvm/*, /usr/java/*, /opt/java/*
    • macOS: /Library/Java/JavaVirtualMachines/*, Homebrew locations
    • Windows: C:/Program Files/Java/*, Eclipse Adoptium, Microsoft JDK

JavaConfig Class

Holds detection results:

  • java_home: Path to JDK installation
  • include_paths: JNI header directories
  • lib_paths: Library directories
  • libjvm_path: Path to libjvm shared library
  • is_valid: Whether detection succeeded
  • version: Detected Java version

SConstruct Updates

  • Changed --without-java default to False (enable auto-detection)
  • Use detect_java_config() for robust detection
  • Only enable Java features (SWIG wrapper, plugin compilation) if detection succeeds
  • Properly link libjvm

Test plan

  • Test on Linux with OpenJDK installed
  • Test on Linux without Java installed (should gracefully disable)
  • Test with JAVA_HOME set explicitly
  • Test with javac in PATH but no JAVA_HOME
  • Verify Java plugins compile and load correctly

… Modifying Dockerfile for better caching. Adding initial Java plugin support wrappers.
… dependency download fucntion to R language. Adding searching for Perl requirements.
quinnjr added 7 commits June 19, 2022 18:34
Implement robust Java installation detection that works across platforms:

- Add JavaConfig class to hold detection results
- Add detect_java_config() function with multi-step detection:
  1. Check JAVA_HOME environment variable
  2. Find javac executable and derive JAVA_HOME
  3. Search common installation directories by platform
- Support Linux, macOS, and Windows installation paths
- Properly configure JNI include paths (jni.h, jni_md.h)
- Find and link libjvm shared library
- Get Java version for logging

RHEL/CentOS/AlmaLinux specific improvements:
- Check /etc/alternatives/java_sdk symlink first (most reliable)
- Handle java-X-openjdk-VERSION directory naming with arch suffix
- Search for matching JDK when javac resolves to JRE
- Detect RHEL-like systems and provide helpful error messages
- Warn about missing -devel package when JNI headers not found

Changes to SConstruct:
- Change --without-java default to False (enable auto-detection)
- Use detect_java_config() for robust detection
- Only enable Java features if detection succeeds
- Add proper imports for os and subprocess modules

This enables Java plugin support to work out-of-the-box when a JDK
is installed, without requiring manual JAVA_HOME configuration.
@quinnjr quinnjr force-pushed the feature/java-auto-detection branch from 284ccdf to e3be66a Compare February 3, 2026 22:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant