Cheerpj: convert any Java application and library to a browser-based Web app

Hi

Have you ever tried Cheerpj?

It converts Java applications or libraries into JavaScript, it claims to fully support all standard Java APIs including Swing and it doesn’t require access to the source code.

There is a demo here but there’s a temporary server failure preventing it from working. As it’s based on OpenJDK, I expect it to be released under GPL v2 with classpath exception one day.

I’m already using their chrome extension to run applets (I know they’re dead, but college forces them). They run excellent.

I don’t understand why I get an HTTP error 521 (= “the webserver is down, the origin web server refused the connection from Cloudflare”) when trying to run the demos and when trying to use this extension.

P.S: I forced the loading of those two JS scripts and now it works:
https://cheerpjdeploy.leaningtech.com/runtime/rt.jar.sun.java2d.js
https://cheerpjdeploy.leaningtech.com/runtime/rt.jar.sun.text.js

This seems to work pretty well. This could be pretty exciting. I’d pay money if they supported embedding something like the fiddle in websites, similar to CodePen. Where’d you find out about this?

When i worked on web apps (2009-2010) i begin acquaint with framework called (IIRC) “vaadin”. It is also Java-based for web apps.

It’s just info. i think it is the one among others “incomplete” solutions.

Have you looked at this?

The licensing/business model is still a work in progress. As they translate the source code of OpenJDK under GPL v2 with exception license, I doubt that Cheerpj can remain proprietary.

It tries to bring traditional GUI development to the web like Cheerpj but it uses GWT. There are lots of incomplete attempts. For example, bck2brwsr supports JavaFX/OpenJFX and a subset of the Java SE API, there are a lot of similar APIs including TeaVM, Doppio, …

What bothers me about this is just how ass-backwards it is.

Cas :slight_smile:

Also DukeScript is interesting which IIRC can use bck2brwsr or TeaVM in the background, although emphasis there on using the browsers native rendering. Cheerpj seems interesting, but it doesn’t half make the fan on my laptop come to life! :wink: Interesting talk on desktop Java at JCrete including around DukeScript and a possible Electron-like framework using a Chromium frame and the JVM rather than node.js (bearing in mind client-side Java is still quite big inside industry internally). The license of DukeScript would appear not to be ideal for this to gain similar traction though. :-\

All these efforts baffle me. Why Javascript? Seriously just why? It doesn’t have to be the defacto clientside language. Someone integrate the JVM directly into Firefox please, and get rid of all the contentious APIs and sandbox it properly this time. It really can’t be that hard.

Cas :slight_smile:

Surely you mean defacto VM, seen as most of these efforts are about not having to work in JavaScript?! :wink: By the way, I’m mostly with you, but I think it’s a lot to do with the fact that JavaFX is pretty much a dead end. World and his dog is switching to HTML5 UI’s unfortunately.

This is a shame as JavaFX is truly a breath of fresh air to work with, give or take certain minor issues.

Cas :slight_smile:

The version released in July is only for testing purposes, the commercial optimizer which will be released in the end of this year intends to improve a lot the performance.

As far as I know, the company behind Cheerp and Cheerpj is interested in using WebAssembly too, not only Javascript. Ideally, I’d like to be able to target any device supporting a decent HTML5 web browser with the language of my choice, preferably Java. When I need a real JRE, I prefer using a software outside the web browser.

P.S: This rudimentary example in 3D works with Cheerpj:
http://www.dgp.toronto.edu/~mjmcguff/learn/java/11-3d/
Have you succeeded in running something less trivial in 3D with it?

It gets better. Their FAQ has this text.

“Can JavaScript code produced by Cheerp be plugged into Node.js?”
"Yes, it should. However, this has not been one of our areas of focus so far. "

People are asking if they can take their Java code and compile it to JavaScript in order to run it on the server. When Java is already on the server with better stability and performance than JS.

Yeah, that’s what got me excited about the idea of embedding a Java editor directly in a website. I’ve seen a few other online editors, but they can’t handle Swing and UI stuff.

I happily pay for a CodePen account so I can do this. I’d happily pay for the ability to do this with Java.

We must go deeper. Can we have a JavaScript engine inside the Java that’s executing as JavaScript?

Well, there’s Nashorn…

Cas :slight_smile:

I’m going to use Icedtea-web with Firefox ESR 52.2 under Mageia Linux 6 to run some applets to compare with Cheerpj. Firefox non ESR >= 52 no longer supports NPAPI. Maybe the applets using 3DzzD still work.