Skip to content

18 · Modules

Java / Kotlin · JVM

Share one JVM for Java and Kotlin, with native imports, live objects and Maven dependencies. Source and editor preparation need the matching tools; prepared applications need a compatible JRE. JVM 8, 11 and 23 are verified on Windows x64.

On this page

Run locally with the matching plugin and runtime. These examples do not run in the browser playground.

Java / Kotlin / JVM.

42-extern-kotlin.zolo
// parity-timeout-ms:300000

use plugin jvm::{kotlin}

extern kotlin fn greet(name: str) -> str {
    return "Olá, $name!"
}

extern kotlin fn exact(value: int) -> int {
    return value
}

extern kotlin fn relay(callback: fn(int) -> int) -> int {
    return callback(41L)
}

extern kotlin async fn later(value: int) -> int {
    import kotlin.coroutines.suspendCoroutine
    import kotlin.coroutines.resume
    return suspendCoroutine { continuation ->
        Thread { continuation.resume(value + 1L) }.start()
    }
}

let value = 40
let answer: int = extern kotlin { value + 2L }
print(greet("Kotlin"))
print(exact(9007199254740993))
print(relay(|number| number + 1))
print(answer)
print(await later(41))

// expected:

// Olá, Kotlin!

// 9007199254740993

// 42

// 42

// 42

Requires the Zolo CLI/host — open in the playground or run locally.

Preparation and deployment

Source-free packaging can retain prepared foreign artifacts, but does not remove runtime or platform dependencies. VM, native and LLVM hosting are covered; foreign bindings reject unsupported WebAssembly targets. The recent provider acceptance covers Windows x64. Python acceptance specifically covers CPython 3.12; other platforms need their own verification.

Reference overview

Global index

Find your way through Zolo

Try an idea

Start here

9 results

9 results

enespt-br