To use a Java applet on the WWW a user must have a Java-compatible browser, such as Navigator from Netscape Communications Corporation, Internet Explorer from Microsoft Corporation, or HotJava from Sun Microsystems. A browser is a software program that allows the user to view text, photographs, graphics, illustrations, and animations on the WWW. Java applets achieve platform independence through the use of a virtual machine, a special program within the browser software that interprets the the code that the applet is written for the computer's CPU. The virtual machine is able to translate the platform-independent bytecode into the platform-dependent machine code that a specific computer's CPU understands.
Most of the free interactive applets on the web are Java -- based, while a few others use technologies such as Shockwave or Perl and CGI. Presumably Java is so popular because it's an evolution of classical languages such as C and C++, and so there was a large pool of programmers able to learn Java quickly, and for whom programming interactive applets was a good way to test their skills and have fun at the same time.
Downloading and installing Java applets is almost always a very simple and easy process. There's usually a link to a zipped file (possibly compressed also). Get the file over to your server (see Part 1 for instructions if you need them) and unzip it in the directory where you want it.
As a matter of good file management practice, I recommend you create a new directory specifically for it, as there might be several files. The only other thing you need to do (apart from fleshing out the page, e.g. with user instructions to play the game) is to download the "class" file into the same directory as the page itself. There'll often be an HTML page included in the downloaded zip file that has everything you need, e.g. applet tag and instructions to play. Sometimes you are encouraged to use it as is, but usually you'll want to modify it, for example to suit the style of your site.
As a matter of courtesy (and probably to fulfill the requirements of usage), make sure to include a credit with link back to the author. When you link to your new game, you might want to note any browser requirements, e.g. Java version supported.
Not only are there Java applets for games and puzzles, but also for many other applications, such as site navigation, education, network utilities, and various effects with text and sound. Adding Java applets to a web page is really very simple!
Moiré pattern. You can start and restart the applet by shift-clicking on the pattern. You can also click-and-drag to control the motion of the pattern yourself.
Adding applets enabled with Java technology to your site is much like adding images. The page on which you wish to present the applet needs to reference the location of the applet code. Applet code filenames end with .class . You must include the following HTML code in a web page to load an applet named Moire1:
<applet code="Moire1.class" height="200" width="200"> <param name="bgColor" value="white" > <param name="lineColor" value="0 180 0" > </applet>
Referencing the above syntax, the Moire1.class must be located in the same directory as the HTML file which is calling it. The applet tag specifies where the Java code is, and how much screen to allocate for it. The code attribute gives the name of the file. If it's not in the same directory as the HTML file you're embedding it in, then you'll need to use the codebase attribute to specify the URL of the directory it's in. The content of the applet tag (i.e. stuff between the opening and closing tags) is a set of parameters, if any, and also optionally, any alternative HTML in case the user's browser doesn't support Java (e.g. a screenshot of what the applet looks like).
You may also load .class files that are in different directories than the HTML file. To do this you need to add the CODEBASE attribute to the APPLET tag. The example below would load the applet named xxx.class from the subdirectory applets:
<applet code="xxx.class" codebase="applets" width="100" height="100"> </applet>
Some applets offer the webmaster the freedom to change certain parameters which affect the behavior of the applet. An example of an applet which takes parameters:
<applet code="xxx.class" width="100" height="100"> <param name="backGroundColor" value="FFFF00"> </applet>
NOTE: all file names are case sensitive. Whenever an applet fails to load or reports that it cannot locate a graphic or a class file, the first thing to check is that the names match exactly.
For more detailed instructions, in case you need them, Mike Hall has an excellent short tutorial.
Sources for Java Games and Puzzles
Here are some places where you can find some Java games applets. Virtually all of the applets described below came from one of these sources, and I highly recommend them all! Particular mention should be made of the authors who put in a lot of work, create amazingly professional products, and give it away for free. Thanks especially to Karl Hörnell, and Mike Hall!
- Dick Christoph
- J*va On The Brain
- BrainJar.com Arcade
- Java Boutique:
Java Software Development Tools Development tools allow for the quick development of Java software using a graphical user interface with a drag-and-drop approach. A development tool offers prebuilt components that the user pieces together to build software applications.
by Diana Luckevich and Michael Luckevich. Web page databases provide a simple, inexpensive and effective tool for query and reporting of data on a web page. These databases offer an alternative to client/server databases and HTML lists or tables. A web page database is an interactive system used to search, sort and display records. These systems provide small screen footprints, fast response time and a technique to reduce web server processing.
Java Software on the Internet A good collection of Free Java Applets, Commercial Java Companies - some offer free applets, Commercial Java Product Catalogs, and Java Software Repositories.
Java 1.2 A brief introduction to Java 1.2 and its new features.
Java Resources A collection of some of the best Java resources.
Companies supporting Java These companies support the development of Java and promote Java technologies.
The Java Boutique The Java Boutique is a collection of over 400 applets that you can put on your own pages. It also features Java news, links to other Java resources, and more.