Should I migrate away from Applets and if so to what?
Asked Answered
B

5

6

I'm a hobby programmer working on developing a Java game (JApplet) that runs in a webpage. I've already completed the coding and it runs fine when using Netbeans but I'm having a lot of trouble deploying it. I've signed it, and it runs in a sandbox mode. However, testing it on a number of different computers (mac and pc) and different browsers none of them seem to want to run applets easily.

Having looked into it, seems they present a high security risk (why browsers aren't keen on running them) and the search "Are applets dead/non used" turns up a lot of results agreeing. I have looked for alternatives and seen the following list.

  1. Java Web Start (apparently also dead)
  2. JWrapper (not sure I'm keen on third party supported code)
  3. Start again in Javascript/HTML5

I don't know javascript or html5 so that would mean starting from scratch so not keen on that option.

Java Web Start, maybe its not as dead as people say it is but I don't want to rely on something that may end up being unsupported by browsers in a years time.

JWrapper...seems to only run the application outside of a browser and I'd rather run it one. Also not sure about how long it will take to transfer from JApplet to JWrapper.

I'd really appreciate some guidance on this as I'm starring at three rather questionable options.

Many Thanks in advance

Update

Thanks for all your responses so far. It confirms my fears that I'm working on outdated technology!

I picked up on two things.

  1. GWT to convert Java to JavaScript: I had a quick look at this and though it looks like there is a small learning curve and might be able to do a quick fix this time around.
  2. The answer provided suggesting I should move to JavaScript and HTML5. My main issue is I'm not keen to spend six months learning a new language. Maybe I'm overly concerned about the learning curve. I program in C,C++,Java,C# so I'm pretty good at basic coding (imho) but I've never done any server side stuff. Anybody have any thought on how long it would take to learn?

Thanks

Bott answered 10/6, 2015 at 20:9 Comment(8)
Java in the browser is pretty dead at this point. Java on the desktop isn't doing so well and some browsers have banned the Java applet plugins.Mordecai
Chrome no longer supports applets, it has a 40-50% market share. That's about half of browsers that won't and never will support your applet. Applets are dead! Webstart is no different really, avoid. I would suggest you look into GWT, it compiles Java code to a JavaScript application. Your code should be easy enough to port.Macroclimate
@Mordecai Java on the desktop isn't doing so well What?! Where did you get that from?! Java on the desktop is going just fine.Macroclimate
I have been there, I used to be a fervent Java programmer wary of Javascript. Some tough love: Java in the browser is extinct, and Javascript is easier to learn and more powerful than you think.Boarfish
@ValentinWaeselynck Actually, Java is easier to learn. Enough about opinions, though, and back to the question...Musette
And that, @mbomb007, is your opinion :). As I have been in Alex's shoes and explored the option further, I believe my testimony is relevant. Of course, you are free to provide your own.Boarfish
"Java Web Start (apparently also dead)" Why do you say that? "I don't want to rely on something that may end up being unsupported by browsers in a years time." A browser does not need to 'support' Java (desktop) apps. All it needs to do is download the JNLP when the user clicks the link and supply it to the OS for further handling.Elledge
HI @Alex Levitt did you find a solution mate???Multiplex
W
3

If you're serious about it, you should definitely go with JavaScript/HTML5, because it's the only option available in all major browsers, including mobile versions.

If it's just a hobby, you can still use Applets for now, but note that Chrome, as well as Edge (new Microsoft browser that should replace Internet Explorer) no longer support Java plugin. Firefox should still support it for foreseeable future, but even they don't recommend using plugins like Java. Safari also supports it for now.

Update 1

Mozilla announced that NPAPI Plugins support, including Java, will be removed from Firefox by the end of 2016.

It means that the only mainstream browsers that still support Applets will be Internet Explorer (which is no longer developed) on Windows, Safari on Mac OS X, and nothing on Linux.

If you still prefer to use Java instead of JavaScript/HTML5, the only good option is Java Web Start. It only uses browsers to launch Java applications that don't interact with the browser once they are launched.

Update 2

Today Firefox 52 was released. Mozilla dropped support for NPAPI Plugins including Java (Adobe Flash is the only exception) starting from this release. Apple is preparing to do the same for Safari. Internet Explorer is the only major browser left with Java Applets support.

Oracle is deprecating the Applet API in Java 9.

Weltpolitik answered 10/6, 2015 at 20:25 Comment(2)
I agree, the direction the web is heading is very much a no-plugin-needed direction. HTML5/CSS3 and Javascript will remain ubiquitous for the forseeable future and don't require anything that shouldn't be a part of all browsers accross platforms.Cathleencathlene
I made the jump in this direction. Javascript development as it stands is not sustainable IMO. Modules are a hack, no typechecking results in lost hours debugging stupidities that just aren't possible in Java, there are too many global variables unless you use a framework, Angular is already at v.2 and very differeint than 1.x, etc. I predict before 2020 there will be some new Java-like language that makes Web development safe/easy (as it kind of was with Java) but produces code that runs in all browsers. Kinda like GWT, but popular.Copybook
P
1

Also take a look at Vaadin (https://vaadin.com/framework) as a way of running a Java application as HTML5 in the browser. It has a similar all-Java programming model as GWT, but also handles the server-client communication automatically. It's an open source project and has a good sized library of components.

Presa answered 22/12, 2015 at 17:16 Comment(0)
T
1

You also could use Native Messages to communicate your Native application with a Chrome extension or Chrome apps, but this fix only will work for Chrome.

Native Messages

In Firefox maybe you can use:

js-ctypes

Trochal answered 10/2, 2016 at 17:1 Comment(0)
C
0

I successfully deployed Java Web Start with no problems at all since the first warning that Chrome would be abandoning Java Applets

I am now working on a replacement using HTML5, so far it can do about 50% of what the Java Applet (or Java Application when run with Web Start) can do

Clinical answered 4/12, 2016 at 17:3 Comment(0)
R
0

Firefox version 52 can still run Java applets. In "about:config" page, create a new boolean value "plugin.load_flash_only" with the "false" value. Or you can use directly the Firefox ESR version (entreprises). Hope it helps.

Repine answered 13/6, 2017 at 9:46 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.