Java 8
Java is a high-level, general-purpose, memory-safe, object-oriented programming language.
This is LiveCodes' Java 8 engine: source is compiled and run in the browser by a JDK 8 JVM
interpreter. It runs classic Java, but it cannot compile modern Java source (records, var, text
blocks, switch expressions).
The java-wasm engine (also selected by java) compiles modern Java to WebAssembly in
the browser and is faster and much smaller. Use java-8 only when you need Java 8 behavior for
language-level compatibility.
Usage
Demo:
Communication with JavaScript
The Java code runs in the context of the result page.
A few helper properties and methods are available in the browser global livecodes.java object:
livecodes.java.input: the initial standard input that is passed to the Java code.livecodes.java.loaded: A promise that resolves when the Java environment is loaded.livecodes.java.output: the standard output.livecodes.java.error: the standard error.livecodes.java.exitCode: the exit code.livecodes.java.run: a function that runs the Java code with new input.
Language Info
Name
java-8 (alias: java8)
Extension
.java (the language itself is selected by name)
Editor
script
Compiler
Version
DoppioJVM: v0.5.0, which runs Java 8 JDK.
Code Formatting
Using @wasm-fmt/clang-format, applying Google's Java style guide.