In this second part of a three-part series on using Java with deployment frameworks, you will learn how to deploy applets in a self-contained manner, and what they are and are not typically permitted to do once they are downloaded. This article is excerpted from chapter two of Advanced Java Game Programming, written by David Wallace Croft (Apress; ISBN: 1590591232).
Deploying Java Applets - Dynamic Linking Using Reflection (Page 5 of 5 )
As an alternative, you can also dynamically load the JNLP classes using reflection as shown in this code excerpt from classJnlpProxyin packagecom.croftsoft.core.jnlp.
throw new RuntimeException ( ex.getMessage ( ) ); } }
By saving a singleton static reference to theBasicServiceinstance retrieved, we can then use it within our own staticshowDocument()method. The example method returnsfalseif the client platform does not support JNLP, allowing the calling code to respond with a substitute behavior.
In my opinion, dynamic linking using custom interfaces instead of reflection makes for more comprehensible code. I have found that you almost never need reflection techniques if you keep this in mind.
Please check back next week for the conclusion to 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.