dataslope-tools-jar
v1.0.0
Published
OpenJDK 8 tools.jar (com.sun.tools.javac.Main) packaged for CDN delivery to the Dataslope in-browser Java playground, which drives javac via CheerpJ. Fetched at runtime from unpkg.
Maintainers
Readme
dataslope-tools-jar
OpenJDK 8 tools.jar (containing com.sun.tools.javac.Main) packaged as a
standalone npm package so it can be delivered over a CDN to the Dataslope
in-browser Java playground.
Why this package exists
The Java playground compiles and runs code entirely in the browser via
CheerpJ (OpenJDK in WebAssembly). CheerpJ does not
ship tools.jar, so the playground supplies its own copy of javac and loads
it into CheerpJ's filesystem at runtime.
Hosting the ~18 MB jar on a CDN instead of the app's own origin keeps it off the Vercel bandwidth bill. We use unpkg specifically because:
- jsDelivr refuses
.jarfiles (returns HTTP 403). - GitHub release assets send no
Access-Control-Allow-Originheader, so a browserfetch()is blocked by CORS. - unpkg serves the jar with
access-control-allow-origin: *and, when the version is pinned, an immutable 1-year cache.
The app fetches it from https://unpkg.com/dataslope-tools-jar@<version>/tools.jar
— see TOOLS_JAR_CDN in app/_components/runtime/cdn.ts.
Provenance & license
tools.jar is taken unmodified from OpenJDK 8 and is distributed under the
GPL v2 with the Classpath Exception, the same license as OpenJDK itself.
The corresponding source is OpenJDK 8 (https://openjdk.org/).
Publishing a new version
- Replace
tools-jar/tools.jarwith the new jar. - Bump
versionintools-jar/package.json. - From the repo root, publish (you must be logged in to npm with publish
rights for this package):
This runsnpm run publish:tools-jarnpm publish ./tools-jar;publishConfig.accessmakes it public. - Bump
TOOLS_JAR_VERSIONinapp/_components/runtime/cdn.tsto match the new version so the app fetches the new jar. Pinning the version is what yields the immutable 1-year CDN cache.
Deploy ordering: publish the npm package before deploying an app build that points
TOOLS_JAR_VERSIONat it — the playground fetches the jar from unpkg at runtime, so the version must already exist on npm or Java will fail to start.
