Cheerpj hangs after "Jar is loaded,main is starting"
I am trying to use cheerpj to run my Java Swing app in a browser.
I can run the example SwingSet3.jar example with no problems.
However with my jar the process hangs at "Jar is loaded,main is starting"
Is there anyway of logging where/why it gets stuck?
I can run my app using java -jar , with no problems on Windows 10.
6 Replies
The most common problem is a misunderstanding of how
/app
/ works.
Please share the HTML / JavaScript you are using.
Also check the DevTools console and network tab for errors and 404s<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width,initial-scale=1">
<script src="https://cjrtnc.leaningtech.com/3.0/cj3loader.js"></script>
</head>
<body>
<script type="module">
await cheerpjInit();
cheerpjCreateDisplay(-1, -1, document.getElementById("container"));
await cheerpjRunJar("/app/xfeb24.jar");
</script>
<div id="container"></div>
</body>
<style>
html,
body {
margin: 0;
}
#container {
width: 100vw;
height: 100svh;
}
</style>
</html>
What /where is the DevTools console? Thanks
The DevTools is a feature of modern browsers, not of CheerpJ
The steps to open the DevTools depend on the browser, for Chrome it
Ctrl+Shift+I
Please search for the right sequence for your browserIt pauses on a line "debugger" and I see .... Local
this
:
undefined
a
:
TypeError: cb is not a function at Object.devRandomWrite [as writeAsync] (https://cjrtnc.leaningtech.com/3.0/cheerpOS.js:1859:9) at cheerpOSWrite (https://cjrtnc.leaningtech.com/3.0/cheerpOS.js:2127:23) at Yo (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:106923) at ah2 (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:352619) at US (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:400763) at wasm://wasm/00172642:wasm-function[144]:0x9152 at x7 (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:407857) at C8 (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:402398) at wasm://wasm/00172642:wasm-function[144]:0x9175 at x7 (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:407857) at ye (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:18999) at eval (eval at FI (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:413171), <anonymous>:9:18) at dx (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:31332) at Xl (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:13312) at eval (eval at b$ (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:61007), <anonymous>:1:97) at Vi (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:390068) at Ci (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:73822) at vy (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:11153) at J_4a5428 (eval at Dh (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:65414), <anonymous>:3:126) at Vi (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:389219) at Ci (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:73822) at Object.vy [as a0] (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:11153) at WE (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:70476) at MessagePort.WS (https://cjrtnc.leaningtech.com/3.0/cj3.js:1:20833)
c
:
"cb is not a function"....
There is a bug in the handling of writes to
/dev/random
, a fix has been already pushed to master and I'll be able to share a fixed build in a few hours
Please try again with this build: https://cjrtnc.leaningtech.com/3_20240212_364/cj3loader.js
Please use the regular #cheerpj3 support channel for further problemsThanks ... that worked. It opens up now!