Environment:Haifengl Smile Java 25 Runtime
| Knowledge Sources | |
|---|---|
| Domains | Infrastructure, JVM |
| Last Updated | 2026-02-08 22:00 GMT |
Overview
Java 25 JDK environment with Gradle 9.3.0 build system for compiling and running Smile v5.2.0.
Description
Smile v5.2.0 requires JDK 25 as the minimum Java runtime version. The project uses Java's Foreign Function & Memory API (Project Panama) for native library bindings to BLAS, LAPACK, and ARPACK. This requires the `--enable-native-access=ALL-UNNAMED` JVM flag. The build system is Gradle 9.3.0 with Java toolchain support. Tests require 6GB heap (`-Xmx6G`) with G1GC.
Usage
Use this environment for all Smile v5.2.0 development, compilation, and execution. JDK 25 is mandatory because the codebase uses `java.lang.foreign.*` APIs (Foreign Function Interface), pattern matching for switch expressions, and other modern Java features. Running with an earlier JDK will result in compilation or runtime errors.
System Requirements
| Category | Requirement | Notes |
|---|---|---|
| OS | Linux, macOS, or Windows | Debian Trixie used in devcontainer |
| JDK | Java 25 (OpenJDK 25) | Configured via Gradle Java Toolchain |
| Build Tool | Gradle 9.3.0 | Wrapper included in repository |
| Memory | 6GB+ heap for tests | `-Xmx6G` required by test configuration |
| Disk | 1GB+ | For Gradle cache and build artifacts |
Dependencies
System Packages
- `openjdk-25-jdk` (or equivalent JDK 25 distribution)
- `graphviz` (optional, for documentation generation)
Build System
- `gradle` = 9.3.0 (via wrapper)
- Kotlin plugin 2.3.0 (buildSrc)
- Dokka 2.1.0 (documentation)
Core Java Dependencies
- `org.slf4j:slf4j-api` = 2.0.17
- `org.junit.jupiter:junit-jupiter` = 6.0.2 (test)
Credentials
No credentials required for the base Java runtime environment.
Quick Install
# Install JDK 25 (Ubuntu/Debian)
sudo apt update
sudo apt install -y openjdk-25-jdk
# Verify installation
java --version
# Build the project
./gradlew build
Code Evidence
Java 25 toolchain configuration from `buildSrc/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts:18-21`:
java {
toolchain {
languageVersion = JavaLanguageVersion.of(25)
}
}
Java 25 source/target compatibility from `buildSrc/src/main/kotlin/buildlogic.java-common-conventions.gradle.kts:32-35`:
tasks.withType<JavaCompile> {
sourceCompatibility = JavaVersion.VERSION_25.toString()
targetCompatibility = JavaVersion.VERSION_25.toString()
}
JVM flags for tests from `buildSrc/src/main/kotlin/buildlogic.common-conventions.gradle.kts:10-14`:
tasks.withType<Test>().all {
jvmArgs("-Xmx6G", "-XX:+UseG1GC", "-XX:MaxMetaspaceSize=1024M", "-Xss4M")
jvmArgs("--add-opens=java.base/java.nio=ALL-UNNAMED")
jvmArgs("--enable-native-access=ALL-UNNAMED")
}
Foreign Function API usage in `base/src/main/java/smile/linalg/blas/cblas_h.java:5-6`:
import java.lang.invoke.*;
import java.lang.foreign.*;
Common Errors
| Error Message | Cause | Solution |
|---|---|---|
| `UnsupportedClassVersionError` | Running with JDK < 25 | Install and configure JDK 25 |
| `java.lang.foreign not found` | JDK missing Foreign API | Ensure JDK 25 (not JRE) is installed |
| `OutOfMemoryError` during tests | Insufficient heap | Add `-Xmx6G` to JVM args |
| `InaccessibleObjectException` | Missing module opens | Add `--add-opens=java.base/java.nio=ALL-UNNAMED` |
Compatibility Notes
- JDK 25 is required: Earlier versions (JDK 21, 17, etc.) will not compile due to Foreign Function API and modern switch expression usage.
- Kotlin targets JVM 25: Kotlin modules require JVM target 25 (`JvmTarget.JVM_25`).
- Scala targets JVM 21: Scala modules use `--release:21` for compatibility.
- Native access flag: The `--enable-native-access=ALL-UNNAMED` flag is mandatory for BLAS/LAPACK/ARPACK FFI calls.
- DevContainer: A pre-configured devcontainer uses `mcr.microsoft.com/devcontainers/java:dev-25-jdk-trixie`.
Related Pages
- Implementation:Haifengl_Smile_DenseMatrix_Factory
- Implementation:Haifengl_Smile_DenseMatrix_Operations
- Implementation:Haifengl_Smile_DenseMatrix_Decomposition
- Implementation:Haifengl_Smile_Decomposition_Solvers
- Implementation:Haifengl_Smile_SVD_EVD_Results
- Implementation:Haifengl_Smile_Read_Data
- Implementation:Haifengl_Smile_SQL_Constructor
- Implementation:Haifengl_Smile_InferenceService_Setup