When java was young, people were excited about writing applets. They were cool and popular, for a little while. Now, I never see them anymore. Instead we have flash, javascript, and a plethora of other web app-building technologies.

Why don't sites use java applets anymore?

I'm also curious: historically, why do you think this occurred? What could have been done differently to keep Java applets alive?


I wonder how widespread the JVM actually is? In the case of Flash, IE5 preinstalled it, giving it a large automatic user base. But unless the JVM was included with the OS install, users wouldn't have it. I suppose as a developer you target the largest install base, meaning choosing Flash over Java.

There are Java applets here and there; definitely not widespread though.

Windows has had JVM pre-installed since Windows 95:
Anders Sandvig
Microsoft no longer adds their Java-like product to Windows. However, any half-decent PC manufacturer will install the JRE on Windows. It's unusual for a Windows installation not to have Sun Java.
Tom Hawtin - tackline
+1  A: 

i believe it's their ugliness that kept them away from the modern web. flash brought the design, javascript brought a convenient way to make some cool things on a client. being a box inside a browser (just like a flash, though, but much uglier) applet technology was put away.

actually, the only thing that might be missed is the possibility to have a 'client-server' type of communication inside the web, because java applet could have a stateful connection. on the other hand, you would have to put some server on the other side and open a port for it, which just was too much house-work for shared hosting environments.

applets still live in some different areas, like control centers for roads, tunnels, power plants and stuff like that.

+4  A: 

People still use applets. But you are right, there are tons of different solutions out there. For example, take a look at javafx

Georgy Bolyuba
JavaFX looks like a really sweet technology, but unfortunately it's come about 5 years too late to make a difference in applet popularity.Still, should make desktop Swing development interesting again.
+3  A: 

I think compatibility issues were a big problem. Most notably with IE and Microsoft's Java VM which wasn't as standards compliant as it might have been.

Even with the Sun JVM you could have problems. I've had fun where I've had two 3rd-party Applets requiring different versions of Java which causes all sorts of problems. Sun have tried to solve this problem by replacing Applets with Java Web Start which gives you a link in the browser that launches the application in it's own window instead of inside the browser. (In theory with JWS you can have different applications using different VMs but it never seems to work for me as well as it should.)

Advancements with JavaScript have also made it possible to developer much richer web pages so a lot of things in the past that you could only do in Applets can now be done simply with AJAX.

Dave Webb
+3  A: 

I see them a lot in acedemic settings (hosted on department or faculty sites), but you're right in that they are not very popular.

However, remember that Java's big promise has been achieved. We have Flash, Java Applets, Silverlight, and ever-improving JavaScript frameworks.

Now if I made add a personal opinion - I think that Java applets are inelegant. They tend to look ugly, the Java runtime makes its presence in the OS far too known (in terms of runtime visuals, updates, and the ugly installer). Flash is much better with its rich media environment and its transparent (and ubiquitous) deployment.

Frank Krueger
+18  A: 

I think Java applets were overshadowed by Flash and ActionScript (pun unintended), being much easier to use for what Java Applets were being used at the time (animations + stateful applications).

Flash's success in this respect in turn owes to its much smaller file sizes, as well as benefiting from the Sun vs. Microsoft suit that resulted in Microsoft removing the MSJVM from Internet Explorer, at a time of Netscape's demise and IE's heavy dominance.

Jon Limjap made me laugh! ;)
Gary Willoughby
Touche, Gary. ;)
Jon Limjap
+1 Great answer!

JavaScript, AJAX, PHP, JSP, Flash, Silverlight, etc. etc. etc. All of these things came along and just made interactive web-pages easier to make, so applets weren't required anymore.

This answer has been written long ago, and while I didn't vote this down, I'd like to say what I feel is wrong about it: First, applets run on the client; nevertheless @Lehane compares them with server-side technologies (PHP, JSP), which is clearly an invalid argument. Second, just because other technologies (Flash, Silverlight) appeared doesn't mean that applets would've automatically been doomed; there would have to be a reason why applets were perceived as inferior to the other technologies, but this answer doesn't say anything about this.
+6  A: 

By the time Java's GUI API stopped totally sucking, everyone was using Flash. And even today, Java is no where near as good as Flash at doing fancy graphics.

Jonathan Allen
No more true, with JavaFX... I mean, the examples they give do look cool, don't they?
I don't know. I've never actually seen a JavaFX demo run successfully in Firefox 3.5 on my Mac, or even give me an error message telling me what I need to install. :-(
+1  A: 

The JVM is very widespread, especially in the coorporate world, at least where I've worked, there was always a JVM installed.

I'm currently working on a Java Applet, but in general, I would never an applet unless I had to. But then again, I wouldn't use Flash or Silverlight, either. Applets have a slow load time, and look out of place in webpages. Also, Macromedia/Adobe have outmarketed the good ol' applets.

+6  A: 

I assume it's because java is a "real", ie. general purpose language. To make an applet, you have to write code, and there aren't any shortcuts.

Now that flash etc have come along, you can pretty much just drap and drop your way through making a cool animation for your website. This is a much lower barrier for entry - you don't have to know how to program in order to get a flash animation working. So flash proliferates, and java applets are hardly used anymore.

+4  A: 

I think applets are collateral damage in the battle between Microsoft and Sun.

At first, the JVM was very slow to load and demanded too much memory. Then, when increase in computing power made the JVM possible, Sun played hard as it attempted to control all things Java:

As part of another private antitrust lawsuit filed against Microsoft by Sun in March, Sun sought a preliminary injunction requiring Microsoft to include a current Java virtual machine (JVM) in the Windows XP operating system. Microsoft said the decision to include the JVM this week is a direct result of the latest legal entanglement with Sun, but Microsoft plans to disband support for Java in Windows following Jan. 1, 2004. Microsoft Reverses Course, Will Include Java VM In Windows XP--For Now

+9  A: 

1) AWT made for horrid UIs. Swing improved on that but it was too late, because...
2) Microsoft dropped support for Java in the browser (its propietary MSJVM), and before it did, it would only support the last version it released, which was roughly JDK 1.1 compatible.
3) So today you cannot be sure that an applet will run on the majority of non-developer machines, unlike flash.

Same can be said of ActiveX by the way.

Tony BenBrahim
+3  A: 

They took forever to load up and get going in the browser, and then for a lot of people they didn't work. When they finally did load, the interfaces were ugly and clunky. I think the poor user experience was a big step towards making applets obsolete.

So to answer the original question I have a question of my own - you ask "Why don't sites use java applets anymore", and my response is "why would anyone want to?"

+9  A: 

For what it's worth, Sun is pouring money and resources into applets again. They've made some really significant improvements in JDK 1.6.10 to mitigate a lot of the 'clunkiness' applets used to exhibit. For instance, with this update, you can display your own custom loading image/animation while your applet loads, and the plugin has been put on a major diet to improve performance.

They've also embarked upon an initiative to directly compete with Flash and Silverlight - JavaFX.

Whether or not the market will respond to any of this remains to be seen, but it's certainly a fascinating move on Sun's part given Flash's dominance in the market place.


tastier alternatives like Americano and Latte came along

+3  A: 

First, they not gone. You can still find lot of applets on the Web, lot of people use them particularly to demonstrate algorithms and such.
Advantages: can leverage existing libraries (math, physics, sorting, graph, etc.) and it is faster than Flash.
Inconvenience: it might be risky to target a recent JVM (although Sun did a good job on automatic updates, looks like lot of people are using Java 1.6 already), load time is a bit slow (even though great progress have been made there).

You can still find lot of game applets too, like Bookworm, with the added advantage, perhaps, to have part of work already done to run them on mobile phones...

Second, I can predict a regain of interest with JavaFX. Applets on steroids, able to break legend of "applets are ugly"... :-)

Last, a library like Processing makes super easy to create graphical intensive applets, and you can find lot of them on the Net, eg. on OpenProcessing where the worst (beginners in programming) is near the best!