JVM Specific Features
When running on the Java Virtual Machine (JVM), Kore provides additional features to simplify native library integration and system configuration.
Native Bridge
The NativeInterface object provides a thread-safe way to load native libraries (JNI/C-Interop). It ensures that each library is only loaded once and provides a clean interface for initialization.
Initialization
You can initialize one or more libraries using the initialize method:
Exception Handling
By default, initialize throws a RuntimeException if a library fails to load. You can provide a custom exception handler if needed:
System Properties DSL
Kore offers an advanced DSL for managing JVM system properties through the PropertiesScope. This provides a more idiomatic and safer way to interact with System.get/setProperty.
Usage
Use the properties function to open a scope:
Environment Variables
The Environment object provides a common way to access environment variables. While available on all platforms, it is fully supported on the JVM.
On non-supported platforms (like some web environments), Environment.isSupported will be false, and property access will return null.