Java interop
On this page
Native MatchBox can call Java classes through an experimental JNI bridge. This path needs a JDK on the host and a runtime built with bif-jni; it is not available in the browser.
Calling a class
Use a java: import to refer to a Java class:
import java:java.util.ArrayList as List;
items = new List();
items.add( "hello" );
items.add( "MatchBox" );
println( items.size() );
2
Java collection indexes follow Java's rules, so they start at 0 rather than BoxLang's 1.
Choosing an integration
The bridge is useful for accessing host libraries, but MatchBox is not a JVM implementation. Check the methods and runtime dependencies your application uses.
A MatchBox-compatible module can also provide a native backend for selected Java-facing APIs. For Rust code owned by your application, use Native Fusion.
See the Java interop example for a complete project. A standalone executable needs the same required integration support as the CLI that runs it.