Using Java Applets

IE publications compiled with HTML Executable can run 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 JVM (update 8 build 77).

Oracle has made execution of Java applets really difficult for obvious security reasons.

Some guidelines

In order for Java applets to work in a compiled HTMLEXE publication, you’ll have to:

Modifications to use the built-in server

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>

    var localpath = window.external.GetGlobalVariable('HEBuiltInServerHost', ''); 

    document.write('<applet codebase="' + localpath + 

    '" code="Clock3D.class" align="bottom" width="200" height="200">'); 

</script>

Working demonstration

The following Java applet is a “3D clock”:

Example not available in this online documentation: please run the offline help from HTML Executable to have a working example.

You should see the applet like on this screenshot:

img

The HTML code used:

<script type="text/javascript">

var localpath = window.external.GetGlobalVariable('HEBuiltInServerHost', ''); 

document.write('<applet codebase="' + localpath + 

'" code="Clock3D.class" archive="clock3d.jar" 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>

Credit: Bennet Uk


Copyright G.D.G. Software 2016. All rights reserved