Search code examples
javagoogle-chromeappletnpapi

Is there a working widget for Chrome that will allow my website to run Java in Chrome


Is there any middleware that will allow me to run Java applets in Chrome on my website, by running it in a sort of encapsulation shell? I'm looking for something that will run the Java Applet on chrome in a sort of feed-in to the app, convert and spit-out the result fashion.

I'm aware that chrome doesn't support NPAPI anymore, hence the question. Is there anything that will act as a middleware to bridge the incompatibility gap

Does such a thing exist?


Solution

  • There is no adapter or middle ware that would allow this sort of behavior, nor do I think it would even be possible to build it.

    If I understand your question correctly, your goal is to allow an arbitrary end-user who is running Chrome to successfully interact with your Java applet running in your website, without the end-user having to download or install some kind of plug in. Your idea is that there is some kind of feature or software that would take your Java Applet code and wrap it or turn it into something that can run natively in Chrome. This simply isn't possible, as there isn't any language or code base that Chrome can interpret that would be able to encapsulate your Java code.

    Most of what you can do with a Java applet can be done with client-sided JavaScript and HTML 5, but the language features are too disperse for a JavaScript wrapper for Java code to be possible. There are of course tools for converting Java code to JavaScript and there are several Stack questions about the topic. Try here or here.

    Just how easy it will be to convert your code will depend on what language features and libraries you are using. Some amount of rewrite will be necessary no matter how smoothly it translates. You are probably better off rewriting your applet to JavaScript.

    If instead you are asking if there is some sort of plug in or extension for Chrome that will get around the non-support by wrapping the Applet into something Chrome will allow, then the answer is most definitely no. Compared to Firefox, the Chrome extension API is much more restrictive with what kinds of things it allows, and I'm sure that even if someone managed a way to bypass Google's explicit decision to stop supporting Java Applets for secutiy reasons, the Chrome team would quickly shut down the extension or project.