Specify a Particular Version of Java for Self-Hosted Applets

Yesterday, I looked at how you can run an older version of Java in parallel with an existing installation and then explicitly use the older version for all Java applications. Whilst this is an easy solution to implement it does create potential security risks for computers that are using older versions of Java containing known exploits.

However, you can tighten things up significantly by nominating a specific version of Java to execute your self-hosted Java applets. Of course, the computers of interest will need that version of Java already installed (as per the article for yesterday). Implementing this specification is incredibly easy and can be done by using a small snippet of code, specifically:

classid=”clsid:CAFEEFAC-XXXX-YYYY-ZZZZ-ABCDEFFEDCBA”

  • XXXX is the major version number (so 0015 would be Java 5 or 1.5 in the older numbering and 0016 would be Java 6 or 1.6 in the old numbering),
  • YYYY is the minor version number (this will normally be left as 0000 from Java 5 onwards but would be 0002 in the case of Java 1.4.2),
  • ZZZZ is the update version number (so 0023 would correlate with Update 23).

With that in mind, you can do the following to implement the code:

  1. Open the HTML source file,
  2. Locate the applet tag in the source code referencing your Java applet,
  3. Paste in classid=”clsid:CAFEEFAC-0016-0000-0023-ABCDEFFEDCBA inside the applet tag,
  4. Save and upload your modified source file.

Next time you visit the page on the Internet it will use the specified version of Java (even though the icon in your system tray may indicate you are using the most recent version). If you find that it doesn’t work straight away you might need to clear your browser cache and try again.

Leave a Reply

Your email address will not be published.