WWW FAQs: What is Java?

2007-08-08: Java is a technology that allows software designed and written just once for an idealized "virtual machine" to run on a variety of real computers, including Windows PCs, Macintoshes, and Unix computers. On the web, Java is quite popular on web servers, used "under the hood" by many of the largest interactive websites. Here it serves the same role that PHP, ASP or Perl might, although traditionally Java has been used for larger-scale projects.
"I just need to know: should I update Java? Can I get rid of Java?"

You need to do one of the two: keep it updated or get rid of it. Either is fine for most users. Yes, it is safe to update Java. See my article should I update Java? for complete answers to these questions.

Java can also be used to create small programs, known as "applets," to be embedded in web pages. For instance, a web page using Java could contain an interactive weather map, a live display of subway trains, or a video game, without the need for the web server to do all of the work. Unlike normal software such as .EXE files, these "applets" can not access or delete your personal files unless they ask for and are given express permission to do so. In the real world, users hardly ever give permission for this, so applets generally don't ask.

As of this writing, Java is usually (though not always) included as standard equipment on Windows PCs. If you choose to use Java applets on your site, you can invite your users to download the Java plug-in from Sun's website, using the "Get It Now" button on that site.

If you're running Java on your server, browser users don't need to have Java runtime environments, just as users don't need to have PHP or ASP on their home computers to access websites that use them. At the end of the day, what is delivered to the web browser is plain old HTML! You only need to worry about the user's Java runtime environment if you choose to use Java Applets in your pages. This is the only time when Java code must run on the user's computer.
Java is not the only way to embed applet-like capabilities in a web page these days. It's not the most popular or widely supported, either. As an alternative to applets, see the JavaScript and Flash entries.
JavaScript and Java are completely different things. JavaScript used to be called LiveScript. The similar names were a marketing decision made by Sun and Netscape many years ago. You do not need a Java runtime environment simply to include JavaScript in a web page.

Java Examples

Java can be used on PCs for both applets (interactive features inside web pages) and stand-alone applications (non-web programs like Notepad or Excel— these are not written in Java, they are just examples of applications).

Java applets have been almost completely replaced by Flash, but there are occasional jobs for which Flash is ill-suited. An example is my own Fracster mandelbrot set explorer, which lets the user explore an interesting mathematical function in a graphical way. While not impossible in Flash, this sort of mathematically intense, pixel-by-pixel display is better done in Java.

There are also many older applet games, such as Atari's official Asteroids applet, that simply haven't been rewritten in Flash.

The Azureus file-sharing application is a good example of a popular stand-alone application written in Java.

Legal Note: yes, you may use sample HTML, Javascript, PHP and other code presented above in your own projects. You may not reproduce large portions of the text of the article without our express permission.

Got a LiveJournal account? Keep up with the latest articles in this FAQ by adding our syndicated feed to your friends list!