Hacker News new | comments | show | ask | jobs | submit login
CheerpJ Applet Viewer – Runs Java applets without a local Java installation (chrome.google.com)
130 points by apignotti 7 days ago | hide | past | web | 67 comments | favorite

The only, and still unmatched, advantage of using applets was having access to external devices, such as smart card readers, in order to be used with eID, for example. This is not possible with this plugin. The only interest would be for some old applets you don't have sources anymore and aren't techie enough to use a decompiler to retrieve some codebase to work with.

In 10 more years we'll almost be where applets where 10 years ago!

Except now in a slower single threaded language with a worse GUI toolkit.

If I had to pick only one flaw in Java. It would be its horrible and ugly GUI. I mean... it managed to make anything ugly.

I agree with the broader point that web tech is basically playing catchup with years of lag compared to existing technologies. However the one benefit we get from all this is real security and true universal runtime.

I remember that the official Microsoft JVM (which was quickly discontinued) used native Windows GUI controls to display the Java UI, and then later, the JVM on Mac OS X displayed Swing(?) apps with native controls. I thought it was all very neat, but against the interests of the companies.

Java applications on mac had a very uncanny way of showing native controls. It is a bit like Qt, it kind of looks like a knock-off - elements are out of alignment, weirdly sized and so on.


Wonder what the returns in their Java>JavaScript framework?

I don't know about that. Modern HTML apps can easily render things that Swing never could back then.

And a fraction of the security problems? Nobody misses the Sun update dialog.

None of which are a standard or work on a general web browser. Hell, none of those work without specific command line switches even on Chrome.

I don't think its an advantage. You need to install java on your pc and allow the java plugin full access to your device.

Not to mention it's insanely hard to get the plugin working, and when an update is out, the plugin will refuse to run your applet until you upgrade. Java continues to be a pain in the ass.

From the description, it sounds like perhaps they transpile Java Bytecode to Javascript?

> Based on CheerpJ, a solution to convert Java applications to JavaScript, the Applet Viewer extension compiles the Java applet on the fly, without relying on any remote server.

Yes, from the FAQ: "The CheerpJ compiler, based on LLVM/Clang, as well as on parts of Cheerp, converts Java bytecode into JavaScript, without requiring the Java source. CheerpJ can be invoked on whole Java archives (.jar) or on single .class files, and generates a .jar.js (or .js) output. "

We've seen this plenty with GWT and the likes, but this one is self-hosted in the browser to support dynamic class loading. As with Emscripten, the real struggle is the stdlib, not the translation. As an alternative, I would recommend people look at TeaVM[0].

0 - https://github.com/konsoletyper/teavm

Another related project is Doppio, an open source JVM written in TypeScript,


It doesn't seem to detect applets loaded in <object> tags, only <applet> tags, and then only the first applet embedded on the page, which seems like an oversight. Specifically, this one:


These are definitely bugs, please report them on the issue tracker here: https://github.com/leaningtech/cheerpj-appletrunner/issues

One of notch's old java 4k games, fails to start? Cpu is pegged on a core, and the heap keeps growing. Notch used to write his own bytecode for these, would be a good test case me thinks! More of his games on this site.


Applets were/are a terrible idea, but they started us down a path of improvement that's lead us to where we're at today with browser technology.

I really wish we had a powerful virtual machine like the JVM in our browsers though... Client-side frameworks are making the web much slower and are eating battery life.

Web assembly is a step in the right direction, but the "not invented here syndrome" makes my head hurt.

Running the JVM in the browser had a horrible security track record. WebAssembly operates within the well defined parameters of the pretty decent for security Javascript sandbox. I'm not sure NIH is particularly fair, especially considering the relatively quick wide spread adoption WASM has seen.

I disagree. The Java -can- library has a terrible record and allows for all kinds of terrible things. The JVM itself is a memory model.

What are features of the Javascript VM in current browsers that make it less powerful than the Java VM?

Single threaded, no 64 bit integers.

Also, dynamically typed (a feature rarely used and very costly)

What do you mean by 'rarely used'?

Firefox lags with GC due to a painful decision to permit C to point to JS directly.

More information on the technology behind this can be found here: http://blog.leaningtech.com/2017/06/announcing-cheerpj-java-...

can't wait to try running Runescape with this and watch my CPU explode.

I wanted to try this out, since, my company still has some legacy code and we use swing/applet as our frontend. It has worked very well so far, but after NPAPI support has been dropped from Chrome and Firefox it getting tough to keep that as our frontend now. We have slightly moved to HTML5.

I installed and went to https://www.java.com/verify/ on google chrome and still says "The Chrome browser does not support NPAPI plug-ins and therefore will not run all Java content. Switch to a different browser (Internet Explorer or Safari on Mac) to run the Java plug-in."

Am I missing something here?

Click on the CheerpJ extension icon and and then click "Run Applets". Sites such as that one dynamically check if the Java plugin is available and CheerpJ needs to refresh the page to properly spoof the plugin availability.

You have to click on the extension and on "Run Applets" after loading the page, it works fine for me («Congratulations! You have the recommended Java installed (1.8.0_300).»)

The demo takes a minute to initialize (firefox, windows 10, surface 3 pro) then shows a window that ignores all UI conventions.

Yup, they got the applet experience nailed down perfectly :)

(Somewhat joking. The technology behind it is still extremely impressive)

I want to make a browser plugin that runs a full Linux VM with OpenJDK and runs Java applications sandboxed in its own full OS. That way you get the full Java capabilities and can pass through hardware that you want, or maybe give it permissions like mobile apps. Could also run C#, native code, etc.

Neat, gives Chromebooks some new options. I have a few things I'd like to try, like Dell iDrac.

These demos allow you to test this tech without installing an extension:


It's kinda fun to see Swing again...

Funny. Just posted about Swing yesterday and, in particular, as a solution to what current JS frameworks are trying to achieve:


I'm not advocating traditional applets, but the Swing paradigm is actually near-perfect for the job.

first CheerpJ demo will download of approximately 25 MB. !!

> You are 2 clicks away from the applets you need or you love.

lol, so they're mutually exclusive?

No, otherwise it'd be "you need xor you love".

Generally yes. I've yet to encounter a Java applet that I've both needed and loved at the same time. Every applet I've used has either been some awesome but impractical/silly toy (e.g. science demo toys) or some mission-critical but painful-to-use monstrosity (like ADP eTime or my work's HVAC interface).

That's been my experience.

A similar project is shumway, an implementation of Flash with JavaScript: https://github.com/mozilla/shumway

Shumway development has been discontinued. See https://bugzilla.mozilla.org/describecomponents.cgi?product=...

I currently have to use IE10 to log in to my work's Citrix remote access solution as it is the only browser that still supports Java. I wonder if this extension would work for that?

the only reason we use a java applet, is because javascript has no api to access a smartcard reader. unfortunately this project can not solve that use case.

this can change soon. https://wicg.github.io/webusb/

About time :) Lots of fun and useful things were applets (OK, mostly fun things).

It would be a shame to lose all of them (similarly for J2ME).

I've been aching for a solution to run Webex on current browsers on Linux. Sadly, this doesn't appear to do the trick.

For what it's worth - you can do this with firefox(others may work, but it's my go-to for this process).

Short summary of the steps: 1) First try to join a webex, let firefox download and install the webex plugin 2) Look in ~/.webex, you'll see a bunch of 32-bit binaries 3) `ldd` on the 32-bit binaries, and install the 32-bit requirements to satisfy the missing dependencies. 4) Restart firefox, join the webex, you're done.

The big issue is that the plugin they download assumes you are using a 32-bit OS, and will fail to load without much in the way of meaningful error messages.

As far as I know Webex always needed the Oracle JVM and wouldn't run on anything else, so that would have been rather surprising.

I'm using a recently released HTML5 version of WebEx on Linux at work now. It does (did?) have a stupid bug though. When you enter your name, you have to click the button to enter the room. If you just hit enter with the keyboard it would still try to load the Java version.

Same, I just move the meeting to something Linux compatible like Hangouts or GotoMeeting. Also, if not presenting, Webex android/iphone client is also an option.

I like it. Java is slow again! /s

I hope there is ActiveX runner, so I did not rely on IE in Windows.

Awesome piece of tech. However I guess this will not stay free forever.

Lets start running android apps in the browser!

The title seems a bit strange to me:

"without JVM" - providing what is necessary to run Java is a JVM in my book. That you compile Java to JavaScipt is just an implementation detail, isn't it? EDIT: Yeah, ok. It emphasises that you don't need an extra JVM on your computer.

"fully client side" - isn't that how Java Applets always have been executed?

"no plugins" - Not sure what you mean by "plugin". Installing an extension does not match that?

Hmm.. ok, ok I am nitpicking :)

Could you instead provide a bookmarklet that runs Java Applets on websites? That would be something I would use. I would not install an extension because I don't want your code to run outside of the browser sandbox.

The description provides some clarity (can't fit everything in a title!)

"without JVM" means you don't need a "standalone" client-side JVM install (outside of this extension).

"fully client side" means it's not doing something like "execution on a server, streamed video to the client"

and "no plugins" means it doesn't require a "chrome plugin". In chrome plugins != extensions. Flash and java were plugins, extensions are written in JS.

Does sound strange at a glance, but I think these are implicit references to what we traditionally know about applets: they generally required the full JRE JVM install/plugin.

So, it's advertising that this is no longer required, and that they haven't achieved it with any server-side tricks.

The extension itself is actually minimal, all the real work happens inside the page by injecting a script. Also the extension is not invasive as it asks for permission on a site by site basis.

"no plugins" probably means that the extension doesn't install native code, but is written in JavaScript that's run in the browser.

Seems the extension converts Java to JavaScript before executing anything, that's why it gets by without a JVM.

Ah, so it's merely a machine that implements a virtual version of the Java runtime.

"Our unique Java-to-JavaScript technology converts Java to JavaScript on the fly directly on the browser."

Seems like a transpiler. But it would have to be a half-baked JVM written in JavaScript under the hood.

And projects like this is why I use chrome. The gulf between firefox and chrome continues to expand.

Java applets? 2005 called, they want their hackernews posts back.

Sadly, vendors are still shipping hardware that requires Java applets for critical functionality. (ASRock, I'm looking at you.)

Guidelines | FAQ | Support | API | Security | Lists | Bookmarklet | DMCA | Apply to YC | Contact