Using Java Applets

IE publications compiled with HTML Executable can contain Java applets, although support for any Java applet is not guaranteed. A Java Virtual Machine is required. For instance, the Java applet below was working with Oracle Java JRE Version 6 Update 27 on Windows 7 x64.

Some guidelines

  • the built-in HTTP server must be enabled in your publication.

  • add the following JavaScript script to your HEAD HTML tag:

<script type="text/javascript">
window.external.StartInternalServer();
</script> 

  • the codebase attribute of applet tags must be explicitly written with JavaScript in the HTML document. In fact, the codebase should be set to the root path of the built-in HTTP server.

<script type="text/javascript"> var localpath = window.external.GetGlobalVariable('HEBuiltInServerHost', '');
document.write('<applet codebase="' + localpath + '" code="Clock3D.class" align="bottom" width="200" height="200">');
</script>

  • add the CLASS file(s) and any additional file(s) they require to the Page Dependencies of the HTML page that embeds the Java applets.

Working demonstration

The following Java applet is a "3D clock":

The HTML code used:

<p class="center">
<script type="text/javascript"> var localpath = window.external.GetGlobalVariable('HEBuiltInServerHost', ''); 
document.write('<applet codebase="' + localpath + '" code="Clock3D.class" align="bottom" width="200" height="200">'); 
</script>
<param name="fps" value="18" /><param name="a1" value="12500" 
/><param name="pixd" value="29" /><param name="pixangle" value="5" 
/><param name="radius" value="26" /><param name="roty" value="-4" 
/><param name="rotx" value="0" /><param name="rotz" value="0.401" 
/><param name="irotx" value="0" /><param name="iroty" value="0" /><param 
name="irotz" value="00" /><param name="color" value="#00FF66" /><param 
name="bgcolor" value="#000000" /><param name="12hour" value="0" 
/></applet></p>

Credit: Bennet Uk

img Another Java applet demonstration


About

This is the online documentation of HTML Executable.

About HTML Executable

HTML Executable is a versatile HTML compiler and ebook compiler: it lets you create secure ebooks and desktop applications with your websites, HTML or PDF documents.

You can easily create attractive ebooks, full-featured HTML applications (RIA) and software, digital publications from your websites, PDF files and HTML documents for online or offline distribution.

Learn more - Free Trial