Home arrow Java arrow Page 4 - Understanding Deployment Frameworks
JAVA

Understanding Deployment Frameworks


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).

Author Info:
By: Apress Publishing
Rating: 4 stars4 stars4 stars4 stars4 stars / 6
April 10, 2008
TABLE OF CONTENTS:
  1. · Understanding Deployment Frameworks
  2. · Managing the Applet Animation Thread
  3. · Reading from a JAR File
  4. · Upgrading Clients with the Plug-In

print this article
SEARCH DEVARTICLES

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.

<html>
<body>
<applet 

 code="com.croftsoft.apps.collection. CroftSoftCollection.class" 
  archive="collection.jar"
  width="600"
  height="400">
</applet>
</body>
</html> 

The preceding code is an example of a simple web page with anapplettag.

<html>
<body>
<!--"CONVERTED_APPLET"-->
<!-- HTML CONVERTER -->
<OBJECT
    classid = "clsid:8AD9C840-044E-11D1-B3E9-00805F499D93"
    codebase = "http://java.sun.com/products/plugin/autodl/ jinstall-1_4-
      windows-i586.cab#Version=1,4,0,0"
    WIDTH = "600" HEIGHT = "400" >
    <PARAM NAME = CODE VALUE =
 "com.croftsoft.apps.collection.CroftSoftCollection. class" >
    <PARAM NAME = ARCHIVE VALUE = "collection.jar" >
    <PARAM NAME = "type" VALUE = "application/x-java-applet;version=1.4">
    <PARAM NAME = "scriptable" VALUE = "false">

    <COMMENT>
    <EMBED
            type = "application/x-java-applet;version=1.4"
            CODE
              = "com.croftsoft.apps.collection.CroftSoftCollection. class"
            ARCHIVE = "collection.jar"
            WIDTH = "600"
            HEIGHT = "400"
        scriptable = false
        pluginspage
            = "http://java.sun.com/products/plugin/ index.html#download">

         <NOEMBED>

             </NOEMBED>
    </EMBED>
    </COMMENT>
</OBJECT>

<!--
APPLET CODE = "com.croftsoft.apps.collection.CroftSoftCollection. class"
  ARCHIVE = "collection.jar" WIDTH = "600" HEIGHT = "400">

</APPLET>
-->


<!--"END_CONVERTED_APPLET"-->

</body>
</html>

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.

blog comments powered by Disqus
JAVA ARTICLES

- Java Too Insecure, Says Microsoft Researcher
- Google Beats Oracle in Java Ruling
- Deploying Multiple Java Applets as One
- Deploying Java Applets
- Understanding Deployment Frameworks
- Database Programming in Java Using JDBC
- Extension Interfaces and SAX
- Entities, Handlers and SAX
- Advanced SAX
- Conversions and Java Print Streams
- Formatters and Java Print Streams
- Java Print Streams
- Wildcards, Arrays, and Generics in Java
- Wildcards and Generic Methods in Java
- Finishing the Project: Java Web Development ...

Watch our Tech Videos 
Dev Articles Forums 
 RSS  Articles
 RSS  Forums
 RSS  All Feeds
Write For Us 
Weekly Newsletter
 
Developer Updates  
Free Website Content 
Contact Us 
Site Map 
Privacy Policy 
Support 

Developer Shed Affiliates

 




© 2003-2017 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap
Popular Web Development Topics
All Web Development Tutorials