Java games can be deployed using various types of deployment frameworks. This article helps you understand the three different kinds of deployment frameworks, and shows you how to deploy your games to all three types without having to recompile your code. It is excerpted from chapter two of Advanced Java Game Programming, written by David Wallace Croft (Apress; ISBN: 1590591232).
Understanding Deployment Frameworks - Upgrading Clients with the Plug-In (Page 4 of 4 )
One of the main problems with applets embedded in browser clients is that many of them only support older versions of Java such as 1.1. I have always held the position that it is better to upgrade the client rather than downgrade the code and the skills of the developer. Upgrading the client is not as easy as asking your users to upgrade to the latest version of their favorite browser, however, as the latest version might still contain old versions of Java. For example, at the time of this writing, Internet Explorer ships with Java 1.1 and Netscape with Java 1.3. Because this book promotes code based upon Java 1.4, this can be a problem.
To the rescue is the Java Plug-in, formerly known as the Activator. It upgrades the version of Java embedded in your browser when your favorite browser vendor will not. It does this by adding special tags to the HTML web page that contain instructions to treat the applet like a browser plug-in. When the browser determines it does not have the required version of the plug-in, it prompts the user to download the latest version.
Except for a few liberties that I have taken to wrap long lines to fit the page, the preceding code is what the page looks like after conversion by the Java Plug-in.
The Java Plug-in tool that performs the conversion is called, appropriately enough,HtmlConverter. It resides in thebinsubdirectory of your Java SDK installation. It has both a command-line and a graphical user interface (GUI).
C:\jdk\bin\HtmlConverter.exe -backup original -latest index.html
The preceding code is the command that I used to convert the page. The name of the file to be converted isindex.html. BecauseHtmlConverterreplaces the original file, I had it save a backup copy to a subdirectory calledoriginal. I also told it to allow the use of any version of Java on the client machine that is the same as or later than the latest version of Java. If I did not include the-latestoption, the code would require the user to download a specific version of Java, even when a later version might already be installed.
The Java Plug-in has many more features beyond what I have mentioned here. The 150+ page online book Java Plug-in 1.4.2 Developer Guide describes these features in detail.
Please check back next week for the continuation of this article.
DISCLAIMER: The content provided in this article is not warranted or guaranteed by Developer Shed, Inc. The content provided is intended for entertainment and/or educational purposes in order to introduce to the reader key ideas, concepts, and/or product reviews. As such it is incumbent upon the reader to employ real-world tactics for security and implementation of best practices. We are not liable for any negative consequences that may result from implementing any information covered in our articles or tutorials. If this is a hardware review, it is not recommended to open and/or modify your hardware.