Build and ship

Turn a script into bytecode or a single native executable you can hand to anyone.

On this page

Up to now you have run source files. MatchBox can also build them into something you can ship. This lesson uses a terminal, because a browser tab cannot create files.

Start with this script, saved as hello.bxs. Run it here first to be sure it works.

function greet( name ) {
    return "Hello, #name#!";
}

println( greet( "world" ) );

Output:

Hello, world!

A native executable

matchbox --target native hello.bxs
./hello

MatchBox prints Native binary produced: hello. The result is one self-contained file that contains the runtime and your compiled program. You can copy it to another machine of the same operating system and architecture and run it with no MatchBox and no JVM installed. Build on each platform you want to support, and test the result there.

Bytecode

matchbox --build hello.bxs
matchbox hello.bxb

This compiles to a .bxb file instead. Add --strip-source to leave the source text out of the file. Unlike a native executable, a .bxb needs a compatible MatchBox on the machine that runs it.

Where else can it run?

The same script can be built for other places. Each has its own guide:

TargetGuide
Native executableNative builds
Browser and JavaScriptJavaScript and WebAssembly
ContainersDocker image and WASM container
AWS LambdaAWS Lambda
MicrocontrollersESP32

Targets differ in what they can reach. A browser build has no files or sockets, for example, and a microcontroller has far less memory. Check the guide for the target you pick.

Try it

Build your own script as a native executable, run it, and check that it prints the same thing as matchbox yourscript.bxs.

Edit this page Download Markdown Last updated Oct 27, 2026, 1:45:34 PM Report an issue
Lesson 9 of 10 - Learn MatchBox