I recently encountered a case where it would have been beneficial if
jwebserver supported the Range header.

Specifically, there was a learner who made a swing app and wanted to bundle
it as an exe or put it on the internet. The path we guided him through was
essentially

javac -d compiled --source-path src src/Main.java
jar --create --file project.jar --main-class Main -C src . -C compiled .

So they had a fully runnable jar. From there it was a bit of a lesson on
resources vs. files so that the jar could run self contained, then on to
launch4j because it can make the self contained exe they were looking for.

The other thing they wanted was the browser. Looking into the cheerpj - the
wasm jvm - it seemed as if we could also get that working pretty easily.
Their code was amenable to --release 11 and that's where Cheerpj support
currently stops (though they have stated plans to support the latest jdk.)

There were two issues with this. One is either a bug in cheerpj or their
app, still investigating. The other is that cheerpj requires support of the
Range header on whatever server is serving the jar + html file.

So ideally i would have liked to show them this html and had them run
jwebserver to see their jar run in a browser.

<!doctype html>
<html lang="en">
<head>
    <meta charset="utf-8" />
    <title>CheerpJ test</title>
    <script src="https://cjrtnc.leaningtech.com/4.0/loader.js";></script>
</head>
<body>
<script>
    (async function () {
        await cheerpjInit({version: 11});
        cheerpjCreateDisplay(800, 600);
        await cheerpjRunJar("/app/project.jar");
    })();
</script>
</body>
</html>

Reply via email to