Hello Ethan,
This seems to be a reasonable enhancement request. I have filed
https://bugs.openjdk.org/browse/JDK-8355572 to track this.
Given other priority tasks, this enhancement may not be worked upon
soon. However, on first sight, this appears to be a reasonably sized
change isolated to a very specific part of the code. So if you or anyone
else would like to contribute to this enhancement, please send a message
to this mailing list (the contribution guide is here
https://openjdk.org/guide/). I think this enhancement would require a
bit of experimenting with the code and some back and forth discussions.
That's OK and can be done here in this mailing list.
-Jaikiran
On 23/04/25 7:53 pm, Ethan McCue wrote:
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>