jvm
experimentalTyped Java and Kotlin functions, live JVM objects, async and Maven libraries.
use plugin jvm Plugin snippets can be edited in the Playground, but native capabilities are executed locally with the Zolo CLI.
From import to result
- 01Import only what you use
- 02Copy the smallest example
- 03Run it with the Zolo CLI
Functions¶
| Provider | Description |
|---|---|
java |
Java 8+ bodies, sources and JARs |
kotlin |
Kotlin bodies, suspend functions and .kt imports |
Java and Kotlin execute through one in-process JNI host. Signatures use Zolo types; bodies use their native language. Import the provider explicitly, then call its functions directly.
use plugin jvm::{java, kotlin}
extern java fn upper(value: str) -> str { return value.toUpperCase(); }
extern kotlin fn greet(name: str) -> str { return "Olá, $name!" }
print(upper("Zolo"))
print(greet("Kotlin"))int maps to Java long/Kotlin Long; i32 maps to Java int/Kotlin Int.
Conversions are checked. Public classes retain native identity through
.new, supported methods and mutable fields/properties. Source paths follow
the importing Zolo file. Async functions adapt CompletionStage and Kotlin
suspend operations to Zolo Futures. Callbacks return to the owning Zolo runtime;
exceptions report authored source and support ordinary try/catch.
Declare Maven libraries globally through extern ... deps or
[foreign.jvm.dependencies]. Use zolo install and the shared
auto/manual/offline/frozen policies. Editor analysis never installs packages
or executes authored initializers.
Native Java completion can insert the leading import when accepting a type such as Guava Joiner. Existing imports are reused; conflicting names use qualified insertion. The edits preserve current unsaved text, indentation and UTF-16 positions.
Source preparation/editor queries need a JDK8+. ZOLO_JAVA_HOME selects it.
Kotlin additionally needs the pinned compiler and analysis closure, acquired
explicitly with python plugins/jvm/tools/install-kotlin.py --destination .zolo-tools/kotlin-2.3.20.
Set its printed ZOLO_KOTLIN_HOME/ZOLO_KOTLIN_ANALYSIS_HOME paths.
Artifacts include class files, stdlib and dependency bytes. VM/native/LLVM dynamic/embed/static deployments can use a compatible JRE after removing sources and compilers. Plugin packaging does not bundle Java. Cancellation is cooperative; unsupported varargs/open generic shapes need concrete native wrappers. Windows x64 is verified; hosted wasm-aot execution is unavailable.
See Java examples, Kotlin examples and dependency policies.