leaningtech / cheerpj-meta

Run Java 8 applications, libraries, applets, Java Web Start, and Oracle Forms on the web without legacy plugins.
https://labs.leaningtech.com/cheerpj
459 stars 21 forks source link

Failure compiling #119

Closed gmarshall56 closed 3 years ago

gmarshall56 commented 3 years ago

Running on Windows 10 using the command:

py c:\cheerpj_2.1\cheerpjfy.py myJar.jar

I get this in several places while the command is running: command: c:\cheerpj_2.1\bin\cheerpj "" -llvm -llvm-exceptions -cp C:\Users\IBM_AD~1\AppData\Local\Temp\tmp63ab31qe\rt.jar.dir\ path/to/some/class/aparticularclass$1.class

Can somebody please provide a hint as to what the problem is Is this perhaps a problem with a copy command? Thank you for your time.

marsicplusplus commented 3 years ago

Hi @gmarshall56, Errors during the compilation of the .jar file does not mean that the compilation itself failed.

Does the process outputs a .jar.js file? If so, have you tried testing it?

mstar46 commented 3 years ago

Hello to all!

I have a similar problem: a .jar that I can't compile. I get a visibly incomplete .jar.js (its size, 5 Kb, is much smaller than that of .jar, 50 Kb). The compiler crashes on four of the five .class files. I attach a screenshot that maybe will help someone to identify the problem. compiling

Stranger, with Chrome and its CheerpJ add-on, the applet works fine on two sites, but not on a third which is a copy of the second. http://martin-kraus.org/LiveGraphics3D/cheerpj/anim.html https://maths.ac-noumea.nc/polyhedr/stuff/AniKa/anim-Java.html polyhedra-world.nc/stuff/AniKa/anim-Java.html

Thanks for trying to help me.

sere commented 3 years ago

Hello mstar46,

to help us debug the issue, could you please provide the AniKa.jar file that's failing to compile?

We tried to load all the three websites you linked, and the applet (javaview.jar) works for us on all them.

mstar46 commented 3 years ago

It looks like you haven't received AniKa.jar Here it is in AniKa.zip AniKa.zip

sere commented 3 years ago

Hello mstar46,

I tried to compile AniKa.jar and indeed it fails. Cheerpj cannot find the following classes:

jv/anim/PsAnimation jv/anim/PsTimeEvent jv/geom/PgElementSet jv/number/PuDouble jv/number/PuInteger jv/project/PjProject

You can add them by using the --deps option of cheerpjfy.py. You can read https://github.com/leaningtech/cheerpj-meta/wiki/Getting-started#converting-multiple-jars-to-jarjss-files for more details.

Please let me know if you still have issues.

mstar46 commented 3 years ago

Your suggestion seemed good to me, but it still doesn't work. However, we are making progress: the compilation crashes on only two of AniKa.jar's .class files: MyProject.class and MyProject.class

image

The applet still does not work with Chrome on www.polyhedra-world.nc/stuff/AniKa/animJ_.html I asked a friend to test: none of the three works for him!

sere commented 3 years ago

The message Failure compiling MyProject.class is not an error but an informative message. It means that it was not possible to use the new codegen, therefore Cheerpj will use, for this class, the legacy codegen.

I checked again, and the app works for me with Chrome and the Cheerpj add-on. I don't understand how you are testing the page. By checking the code of the page I saw you have embedded cheerpj on the page itself (which is now commented out). If you are using cheerpj like that you don't have to use the extension, if both are used at the same time the applet won't start.

mstar46 commented 3 years ago

Thank you for these two clarifications. I have done a lot of testing with these pages; I just cleaned up the HTML code.

I had thought of a possible incompatibility between the CheerpJ environment and the Chrome add-on; I forgot to take that into account and to ask you the question. How can we know if a page has or does not have the CheerpJ environment? therefore whether or not to activate the add-on. I don't think a visitor ready to skip is thinking of examining the source code of the page. And if on the same page there are two applets, one using a CheerpJ environment the other requiring the CheerpJ add-on (for example if we have not succeeded in compiling .jar into .jar.js), what should be done? I obviously don't know anything about how the add-on works, but wouldn't it be possible to improve it by giving it the ability to auto-activate? its activation could depend on the absence of "cheerpj" in the call tag of the applet.

On my web pages I use many applets based on LiveGraphics3D by Martin Kraus; they work well with CheerpJ, on all the browsers I have tested, but not AniKa! I became interested in kaleidocycles many years ago, when the subject did not exist on the web. I have tried several times in vain to make a mathematical study of it. When Marcus Engle put his work online I contacted him to offer to translate it into French; to thank me he sent me an offline version of his applet Later,On the occasion of a check of my site with Total Validator (HTML code, links, spelling), I discovered that his site had disappeared and the same for his E-mail. I was saddened by the disappearance of this beautiful work and I decided to give it a second life on my website. When browsers stopped supporting Java applets I switched to Web Start, and when my server stopped being "Java compatible" Martin Kraus discovered CheerpJ. I upadate all the pages and decided to change server (for other reasons). And here we are!

AniKa still works on two servers with Chrome and the add-on: http://martin-kraus.org/LiveGraphics3D/cheerpj/anim.html https://maths.ac-noumea.nc/polyhedr/stuff/AniKa/anim-Java.html but not on my new server: www.polyhedra-world.nc/stuff/AniKa/animJ.html animJ.html being an exact copy of anim-Java.html, could the server be the cause of this problem?

Since the compilation of Anika.jar looks correct, I tried a CheerJ anim.htlm version, but it also doesn't work:

Remove me a doubt: the syntax: "AniKa.MyApplet.class" for the CODE value does it mean MyApplet.class is supposed to be in AniKa.jar?

The directory www.polyhedra-world/AniKa/ contains:

Nothing works! Coding errors? improbable, at least for animJ.html which works on two other servers I am more and more confused...

sere commented 3 years ago

How can we know if a page has or does not have the CheerpJ environment?

Currently there is no supported way to do that from the add-on.

And if on the same page there are two applets, one using a CheerpJ environment the other requiring the CheerpJ add-on (for example if we have not succeeded in compiling .jar into .jar.js), what should be done?

If you are using CheerpJ on the webpage, every .jar that does not have a .jar.js with the same name, will automatically be converted at runtime.

AniKa still works on two servers with Chrome and the add-on: http://martin-kraus.org/LiveGraphics3D/cheerpj/anim.html https://maths.ac-noumea.nc/polyhedr/stuff/AniKa/anim-Java.html

I checked again the page, "http://martin-kraus.org/LiveGraphics3D/cheerpj/anim.html" in reality it has CheerpJ pre-integrated, it does not use the addon.

Remove me a doubt: the syntax: "AniKa.MyApplet.class" for the CODE value does it mean MyApplet.class is supposed to be in AniKa.jar?

This means that MyApplet.class needs to be in the Anika folder. This can be either in a .jar (the name of the .jar is irrelevant) or unpacked directly in the server's folders. This folder is missing on http://www.polyhedra-world.nc/stuff/AniKa/.

mstar46 commented 3 years ago

Sorry, sere, I had left my home for a few days, just to take my mind off things.

I put back the AniKa directory, but it didn't change anything.

I then decided to recreate AniKa.jar containing:

Disappointing result: it doesn't work either. Was my idea stupid? Should I have included in AniKa.jar all the files extracted from javaview.jar? Is there a possibility to put in the applet parameters both AniKa.jar and javaview.jar? may that change something?

One more question: is the coding of anim-test.htm correct? It is not mine (I am almost ignorant in JavaScript), but I have a doubt.

Thank you for your patience.

sere commented 3 years ago

Hi mstar46,

I downloaded http://www.polyhedra-world.nc/stuff/AniKa/AniKa.jar, which the archive anim_.html is getting, and it's the old one. Please try with the new .jar you created.

mstar46 commented 3 years ago

Hi sere,

Done again: same disappointing result. I uploaded AniKa_new.zip in my preceding message ; it contains the AniKa.jar I created and the .jar.js. They are now again online.

sere commented 3 years ago

Can you try to leave out all the .jar.js? Cheerpj will work even without it, it will compile it on the fly. As a second step if that doesn't work, try to put back the AniKa directory (still without .jar.js). Java is case sensitive, so there's a chance it's a different spelling for the AniKa folder.

mstar46 commented 3 years ago

I deleted all the .jar.js The AniKa folder was there but with a misspell in its name (Anika). Now I have the correct AniKa folder and the new AniKa.jar (with the .class extracted from javaview.jar). Tests with or without javaview.jar give always the same result: cheerpj start loading (perhaps a little longer as before) and then stops (no wheel, no "loading").

What about the coding of anim-test.htm? It says "CheerpJ runtime ready" and the wheel turns... for ever!

sere commented 3 years ago

Hi mstar46,

You are now missing some files from the original javaview.jar package and the folder should be named Anika.

What I suggest to you is to go back to the "original version" found on http://martin-kraus.org/LiveGraphics3D/cheerpj/anim.html, which is a bit easier to setup and debug: