Skip to content

JVM APIs

What Java and Kotlin programs run by Elide can use: the bundled JDK 25 and Kotlin 2.5 standard library, classpath libraries, and what is missing.

Read offlineelide help api-jvm

On this page

Elide compiles Java and Kotlin with its bundled javac and kotlinc and runs the program on the bundled JDK in a separate process. The program can use the JDK, the Kotlin standard library, the libraries listed below and its own Maven dependencies.

kotlin
// Versions.kt
fun main() {
  println("JDK ${Runtime.version().feature()}, Kotlin ${KotlinVersion.CURRENT}")
}
utf-8 · kotlin · Lines: 4
Terminal
bash
elide run Versions.kt
text
JDK 25, Kotlin 2.5.0
utf-8 · text · Lines: 1
Component Version
JDK 25
Kotlin compiler and standard library 2.5.0-Beta2
Elide annotations (dev.elide:elide-api) 1.0.0

Single-file runs

elide run Main.java or elide run Main.kt outside a project compiles against this classpath:

Language Classpath besides the JDK
Java Elide annotations
Kotlin Elide annotations, Standard library, kotlin-reflect, kotlinx coroutines, serialization (core and JSON), datetime, io, collections-immutable, html and atomicfu

Kotlin files compile with the kotlinx.serialization and atomicfu compiler plugins. A Kotlin file cannot import Metro; use a project for that.

Inside a project directory (one with an elide.pkl, or below one), a single file also gets that project’s dependencies.

Projects

elide build, elide run and elide test add these libraries to Kotlin source sets. Java source sets get only the JUnit libraries on test sets. The switches go in kotlin.features, except JUnit’s: jvm.features.testing, which removes the bundled JUnit compile APIs and runtime when false; JVM test runs then need junit-platform-console in testPackages.

Library Version Main Tests Turn off with
Elide annotations (dev.elide:elide-api) 1.0.0 Compile, run Inherited —
kotlin-stdlib 2.5.0-Beta2 Compile, run Inherited —
kotlin-reflect 2.5.0-Beta2 Compile, run Inherited reflection = false
kotlinx-coroutines-core 1.11.0 Compile, run Inherited coroutines = false or kotlinx = false
kotlinx-serialization-core, -json 1.12.0 Compile, run Inherited serialization = false or kotlinx = false
Metro runtime (dev.zacsweers.metro:runtime) 1.5.0 Compile, run Inherited metro = false
kotlin-test, kotlin-test-junit5 2.5.0-Beta2 — Compile, run testing = false
kotlinx-coroutines-test 1.11.0 — Compile, run coroutines = false
JUnit Jupiter API and params 6.1.3 — Compile, run jvm.features.testing
JUnit Jupiter engine and Platform 6.1.3 — Run jvm.features.testing

A Java project adds Elide annotations as a compileOnly dependency; see Elide annotations. Other bundled libraries are linked from the binary, without a download, when a project declares them at the bundled version; see Bundled libraries.

elide classpath prints the main classpath; elide classpath test:compile prints what a test set adds.

Not available

Not available Detail
Elide runtime API JVM programs have no Elide global or other runtime object; dev.elide.annotations is the only Elide package.
Calls to or from JavaScript and Python The program runs in its own process, and --interop does not apply. See Languages.
OpenTelemetry Elide injects no OpenTelemetry API, agent or trace context into JVM programs. See OpenTelemetry.
Insight elide run --insights exits with an error for a JVM program. Insight scripts instrument JavaScript and Python.

Reference

Page Covers
Elide annotations Every annotation in dev.elide.annotations: targets, retention and effect.
Bundled libraries kotlinx coroutines and serialization, other kotlinx libraries, Metro, JUnit and kotlin.test.

Samples

Was this page helpful?