Live data from Hacker News

Java in the Browser

jpro.one

41–50 of 113 posts

Re: Java in the Browser

#41
post #29

Earlier quoted context omitted.

Here you go: https://chrome.google.com/webstore/detail/cheerpj-applet-run... CheerpJ does exactly that: it ships a full JVM implementation (including Swing/AWT, Threads, ...) that runs in JS/Wasm inside your browser. The Applet Runner extension detects applets in the page and runs them through CheerpJ. The example that you list seems to work.

I know about the extensions, it's exactly how I was able to run that specific applet, but that's a high friction experience for the user. If the applet does not run it's very unlikely I will install an extension (or search for a Firefox alternative) unless I'm very motivated. I'm thinking more like a line or two you can add to your pages hosting applets, and it would enable any modern browser to use it. Minimal frict…

That is also possible: https://docs.leaningtech.com/cheerpj/Getting-Started

See "Converting an applet"

Re: Java in the Browser

#42

Site is down but it seems like server side rendering which is pretty terrible. There are better solutions for Java developers such as teavm one which Codename One built the web UI support. It supports both web assembly and plain JS. The latter has the advantage of smaller size. Transpiles Java threads into async/await calls. Pretty cool stuff.

What's so bad about server rendering

Well.. I come from the age of dumb terminals so trauma. We have powerful machines today. Using them like a dumb terminal rubs me the wrong way.

Re: Java in the Browser

#43

Anyone remember that Java applet in the nineties where there was some 2D wireframe "animal" moving in a rectangle and there was, IIRC, a tiny circle at each joint and you grab it and move it and it'd move the thing around / distort it. It was the first "serious" Java in the Browser I remember. It was all black & white. Maybe some HNer (not an HNer back then obviously) wrote it back in the days?

Back in college I had an assignment to build some kind of CRM-like system, and the professor made a point that we used Java applets, because that was the future ( https://en.wikipedia.org/wiki/Write_once,_run_anywhere was all the rage). I proposed instead learning PHP and using it for that purpose, but was laughed out of the room. Developing this was a PITA and I feel vindicated that applets faded away soon after, an…

On the other hand, Java has established itself as one of the most common server-side languages for building websites.

Re: Java in the Browser

#44
post #39

I thought we tried this already...

And it was way better than anything before and after, but the current politics the given time killed it (which may or may not be relevant anymore).

The load times and performance for applets were all pretty dismal, and given that about half of them were a site logo with moving waves at the bottom, not so missed. That said, I have a Number Theory textbook which uses computer-assisted explorations (e.g., get lists of pythagorean triples, factor a bunch of large numbers, etc.) and the most accessible version of those was through a set of applets which are challenging to run now (it also has Maple and Mathematica versions of the explorations).

Re: Java in the Browser

#47

Earlier quoted context omitted.

What's so bad about server rendering

Well.. I come from the age of dumb terminals so trauma. We have powerful machines today. Using them like a dumb terminal rubs me the wrong way.

I've recently come to appreciate server rendering for its simplicity, at least for the tasks it is suited for. But I know what you mean. As a user, it's better to have local apps doing the real work.

Re: Java in the Browser

#48
post #34

I have looked around the website and I really have no idea what this is. I feel their marketing and doc could do with a bit more explanation if it's intended for devs. Is it like applets in that there is a runtime in the browser? Or more like GWT which compiles Java to Javascript? Also, the website which is apparently created with the technology, is incredibly slow, at least for me. And the website doesn't give usefu…

From elsewhere (site is down for me): > jpro is a new technology which brings Java back into the browser — without Java Plugin. To achieve that, jpro runs JavaFX on the server and maps its scenegraph directly into the browser. JavaFX is the most recent of the standard GUI libraries for Java. Seems like the Java all runs server-side, but it is effectively using a display device which is "send draw commands via a webso…

I used a graph analysis app ~2011 that communicated with the server over zmq and rendered via lwjgl. At the time, and perhaps even now, it wouldn't have been reasonable to expect adequate performance if all the results of interactive manipulation were executed on the client hardware. Which was unfortunate for me since I'd also spent a few weeks writing code to visualize the same data, and it was definitely a 'works on my machine' application.

I've considered revisiting the problem, but probably not following the implementation discussed here.

Re: Java in the Browser

#49

Interesting. Runs app on the server, does final rendering of the UI's scene graph on the client (within the browser). It's not clear from skim reading if the client side rendering is implemented with the DOM or a canvas element. I've always thought it'd be hysterical to use canvas. The whole browser just to hoist a client side frame buffer. X-Windows reinvented. FWIW, JavaFX is so close to The Correct Answer™. Defini…

The canvas is a powerful tool, especially if you do a lot of graphical work. Rendering the entire UI yourself, gives you complete freedom of layout management. Plus, you avoid any DOM manipulation, directly or through a myriad of JavaScript frameworks. Remember: there is no silver bullet. Example: https://www.isochart.com

Re: Java in the Browser

#50
post #22
post #18

I do not know. .NET created with Blazor a modern Applet tech stack based on WebAssembly and HTML. Would not Java be able to do the same and just port the applet API onto a Canvas? Would not that reactivate a whole existing ecosystem?

Java solutions for JS and WebAssembly as targets are older than Blazor actually, see TeaVM and CheerpJ, and then there was GWT alongside Vaadin.

You left out probably the most widely used one, Google’s j2cl compiler (java->js), which is used quite extensively in many google products for shared business logic. It is the spiritual inheritor of GWT.
Post reply on HN