WasmCoffee needs JavaScript and WebAssembly (Wasm-GC) to compile and run programs. Please enable JavaScript in a modern browser.
WasmCoffee v0.0.15 Wasm-GC
Program.java
Stage & Output Idle
⌨ Standard Input (stdin) Empty

WasmCoffee: In-Browser WebAssembly Compiler with Java-Inspired Syntax

A compiler that doesn't need a server. Your code stays in your browser.

WasmCoffee is a browser-based, client-side compiler: it compiles code written with Java-inspired syntax directly to WebAssembly (Wasm-GC) entirely inside your browser, then executes the freshly compiled wasm on the same page.

No: JDK · JVM · backend compiler · Docker container · compilation service · cloud execution environment.

Just: browser → compiler → Wasm-GC → browser.

The compiler itself is an independent WebAssembly module written in the Odin programming language and compiled to js_wasm32. Write code in the editor above, click Run, and your program compiles off-thread in a dedicated Web Worker and runs instantly with console output, HTML5 2D Canvas rendering, and event callbacks.

Client-side by design

Most online code runners send your source code to a remote container, compile it with a cloud JDK, and stream the console stdout back over WebSockets. WasmCoffee does the opposite: it is a true client-side compiler. Your source code never needs to reach our servers — because there aren't any.

That architecture matters for proprietary algorithms, financial calculations, engineering tools, educational environments, internal developer tools, offline-capable applications, and sensitive data visualisation. WasmCoffee doesn't claim to solve all of those — but it demonstrates how to design software that needs no backend when none is necessary. The entire compiler weighs under 10 MB and runs in your browser, so experimenting with algorithms, testing class hierarchies, or building 2D animations gets instant compilation feedback with zero configuration.

Why this is interesting

A compiler that runs inside the browser. Your Java-like code travels this pipeline without ever leaving the tab:

WasmCoffee compilation pipelineJava-like source flows into a Web Worker hosting the wasmcoffee compiler, through lexer, parser, type checker and code generator stages, out as Wasm-GC bytes, and executes on the browser Wasm virtual machine with console and web/canvas output.Program.javaJava-like codeWeb Workerwasmcoffee.wasmCompiler pipelineLexerParserType CheckerCode Generatorfresh instance per compileWasm-GC bytesBrowser Wasm VMConsoleWeb / Canvas
Source → Web Worker → compiler stages → Wasm-GC → browser execution. Nothing crosses the network.

What it can do

Underneath: primitives (int, long, double, char, …), String, single/multi-dimensional arrays, loops and switches, System.out.println with decimal formatting, the Integer/Long/Double wrappers, System.nanoTime(), and the standard Math library.

Bundled examples compile in under 20 ms; a ~250 KiB source file compiles in under 100 ms on the reference system. Try the examples below — they're more convincing than a feature list.

See it in action

Things I've built with it. Click a card to load the program into the editor and run it:

The dropdown above holds the rest: console and algorithms (HelloConsole, HelloWrite, FibonacciBench, SortingAlgorithms, BrushFire, NanoClock), language demos (StringLab, Ordinals, CaseRanges, AsciiShapes, TernaryDemo, TypedConsts, MultiDim, EnumsAsConstants, SetAsBitmask, FieldAccess, UnicodeText, AddAndCheck), objects and generics (ObjectPolymorphism, ClassHierarchy, VariantsAsHierarchy, ModernRecords, EnumLab, CollectionLab), and more canvas work (Transforms2D, ParticleFountain, WebDomPanel, DomPaint, Breakout2D, Xonix2D, GaugePanel, BasicCanvas, CanvasSnake).

How it works

When you click Run, the IDE sends your source code to a dedicated Web Worker hosting wasmcoffee.wasm. The worker writes the source text into the compiler's linear memory buffer and executes the compiler pipeline — lexing, parsing, semantic analysis, type checking, and WebAssembly GC emission.

Upon completion, the compiled .wasm bytes are transferred back to the main thread and instantiated via WebAssembly.instantiate() with two import namespaces:

Embedded game & graphics library

WasmCoffee also bundles a zero-import creative coding and game-development library directly inside the compiler:

For detailed API signatures, parameter tables, and tutorials, see the Built-in Standard Library Reference Guide ↗.

Why I built it

Why build another compiler? Because I wanted to know how far a Java-like language could be pushed when the target isn't the JVM. Instead of compiling Java to JavaScript or requiring a JVM, I built a small language implementation that targets modern WebAssembly GC directly — and then put the compiler itself inside the browser.

The result is WasmCoffee: a compiler, runtime and development environment that runs entirely on the client.

About the developer

Need someone to solve an awkward technical problem? I'm Ewald Horn, a freelance software engineer based in Cape Town, South Africa. I specialise in the kinds of problems that don't fit neatly into an off-the-shelf framework — compilers, WebAssembly, browser applications, simulations, developer tooling and backend systems.

WasmCoffee is one example of the kind of work I build when I want to explore a problem from first principles — alongside WasmPascal (compiler construction for the browser), ZigBASIC (interpreters and runtimes), Odin systems and graphics work, and games and simulations. I'm a software engineer who specialises in difficult problems at the boundary between languages, systems and the browser. Looking for someone to build something unusual? Get in touch.

Built another compiler too

WasmPascal (wasmpascal.com) — Pascal → WebAssembly, entirely in your browser. An interactive editor, retro text-mode console, Canvas 2D rendering, and playable arcade games, all compiled client-side with zero installation. Try WasmPascal →

Want to learn Java?

If WasmCoffee sparked your interest in the real thing, JavaK (javak.co.za) is a complete open course taking you from Java basics to advanced object-oriented design and algorithms.

Frequently Asked Questions

Does my code leave my browser?

No. WasmCoffee is client-side by design: your source code never needs to reach our servers, because there aren't any. Source is written directly into the compiler's memory inside your browser and compiled in a Web Worker — nothing is ever sent to a remote server.

What browsers support Wasm-GC?

Wasm-GC (WebAssembly Garbage Collection) is natively supported by modern browsers: Google Chrome 119+, Mozilla Firefox 120+, Microsoft Edge 119+, and Apple Safari 18.2+.

Do I need a JVM or JDK installed?

No. Neither an Oracle JDK nor a JVM is required on your machine. The compiler is an independent clean-room toolchain built from scratch and compiled from Odin to WebAssembly, running directly on your browser's native WebAssembly virtual machine without any proprietary runtime components.

How fast is compilation?

Bundled examples compile in under 20 milliseconds, and even a ~250 KiB source file compiles in under 100 milliseconds on the reference system — a pretty fast compile-and-run loop.

Can I build games and 2D animations?

Yes! The built-in Web bridge provides direct access to HTML5 2D Canvas contexts (shapes, paths, text, fills, strokes) and 60 FPS frame updates via Web.requestFrame() — the bundled Pong, Breakout and Xonix games show the WebAssembly games path end to end.

Acknowledgements & Credits

WasmCoffee is built with gratitude on open-source foundations:

Trademark & Non-Affiliation Notice

Java is a trademark or registered trademark of Oracle Corporation and/or its affiliates in the United States and other countries.

WasmCoffee is an independent educational and developer project created by Ewald Horn. It is not affiliated with, sponsored by, endorsed by, certified by, or associated with Oracle Corporation.

WasmCoffee provides an in-browser compiler for code written with Java-inspired syntax, emitting standard WebAssembly (Wasm-GC). WasmCoffee does not contain, use, reproduce, or distribute any proprietary Oracle source code, binaries, libraries, Java Virtual Machine (JVM) implementations, or intellectual property of Oracle Corporation or any third party.

License & Terms

WasmCoffee is freeware provided free of charge under the WasmCoffee End-User License Agreement (EULA).

WasmCoffee — End-User License Agreement (Summary)

WasmCoffee is provided free of charge for lawful personal, educational, and commercial use. All rights are reserved by the author (Ewald Horn). You may not misrepresent the origin of the software or claim authorship of the compiler, IDE, or runtime bridges.

THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED. For full terms, conditions, restrictions, and governing law, see the complete LICENSE / EULA document.