2
\$\begingroup\$

With all the recent interest in developing HTML5 apps and games, and I am curious why all the focus is on Javascript, and not on Java.

Minecraft is a great example of what can be accomplished in a browser, and it's written in Java, not JS. I doubt if it is even possible/practical to attempt such a complex project in JS.

Java is clearly a more powerful platform, and it probably runs significantly faster (this is just my guess, though). About the only drawback of Java I can think of is that it runs as a plugin, and with the trend towards plugin-free browsers (e.g. IE10 metro) Java applets may become obsolete in mobile environments. This has already happened with Flash on iOS.

What do you think? Is there a future in developing Java-based Web apps (especially for mobile devices)?

Thanks

\$\endgroup\$
1

3 Answers 3

1
\$\begingroup\$

Java's main draw currently appears to be as native apps for Android devices. On the web, apps are done primarily using HTML5 and Javascript, while games are primarily for mobile on native (Java/Objective C) and for desktop it is Flash and to a lesser extent HTML5.

Since you limited yourself to only Java or Javascript, I'll say that you choose Javascript. While you might face some issues achieving performance, its future appears more optimistic than Java.

\$\endgroup\$
1
  • 1
    \$\begingroup\$ It does seem that way... if the future is plugin-less browsers, then Java is in the same boat as Flash and Silverlight. It looks like Javascript will be the only choice for Web apps. At least until Google persuades the world to switch to Dart. \$\endgroup\$
    – alekop
    Commented Oct 15, 2011 at 6:12
7
\$\begingroup\$

(Ignoring statements like "Java is clearly a more powerful platform") Short version: The focus is on Javascript because that is the whole point of the HTML5 everything. To allow browsers to do things like play video, audio, and render graphics without needing a plugin for it.

The biggest problem with Java as a browser game option is simply that there isn't any support out there for it. Browser game portals simply don't accept Java games, and pretty much all the money is going to Flash games (and to a lesser extent, Unity, in a few cases, HTML5/Javascript games). With Flash 11 just being released, it's possible to make full 3d games using the Flash plugin, so Java's main advantage there is gone. And with a much higher market penetration of Flash vs Java, it's better overall for people to focus on Flash development. Minecraft is kind of a rare exception, albeit a very well known one.

The main focus for Java-based games right now is actually Android, but for mobile browser games, Javascript or Flash are still the best option (and really, native games are still the best for performance in those cases)

\$\endgroup\$
1
  • \$\begingroup\$ Thanks, that's a pretty detailed analysis. I am designing a Web-based game, with an eye towards mobile support, so Flash is out (no iOS support), and it appears so is Java (no support on Windows Mobile in the future). \$\endgroup\$
    – alekop
    Commented Oct 15, 2011 at 6:21
2
\$\begingroup\$

Google web toolkit compiles Java (even with classes and software engineeting as deep as you like) to the javascript. It supports html5 canvas and even webGl.

It is great Java - javascript combo

For example this - programmed in java, runs in javascript.

\$\endgroup\$

Not the answer you're looking for? Browse other questions tagged .