function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
John L.John L. 

Hosting a (very simple) Java applet on a salesforce.com web-page

I am attempting to host a Java applet as a Static Resource using Java 1.8.0_11. The Java code could not be simpler:

import javax.swing.JApplet;
class HelloWorld extends JApplet {
   public void init() {
      System.out.println("HelloWorld.init()");
   }
   public void start() {
      System.out.println("HelloWorld.start()");
   }
   public void stop() {
      System.out.println("HelloWorld.stop()");
   }
   public void destroy() {
      System.out.println("HelloWorld.destroy()");
   }
}

The manifest file is:

Manifest-Version: 1.0
Application-Name: HelloWorld
Main-Class: HelloWorld
Application-Library-Allowable-Codebase: https://csseht.na5.visual.force.com/resource/1421524096000/
Codebase: https://csseht.na5.visual.force.com/resource/1421524096000/
Permissions: all-permissions
Sealed: true

The error that occurs is:

RuntimeException: java.lang.reflect.InvocationTargetException 

and I suspect a "chicken-and-egg" type scenario. I am unable to specify the correct path in the manifest file, as the Static Resource name/URL location is assigned when the Static Resource is uploaded and saved. (a timestamp-based algorithm of some sort, I suspect).

Thanks in advance for any help you may be able to provide
KevinPKevinP
how are you trying to include it on the actual visual force page? 

Your applet tag's src attribute can look like this: 
"{!URLFOR($Resource.STATIC_RESOURCE_NAME, 'path/to/applet.ext')}"

if you use the URLFOR visualforce will write the proper path to the file server side before delivering the page. Thus eliminating chicken/egg situations.
John L.John L.
I'm using the OBJECT tag, and I've replaced the archive attribute tag with the src attribute, and received the same error trace. (Java console output for either is available upon request).

Perhaps you could provide an authoritative reference for the correct syntax.

This USED TO work with the syntax I'm using, and it wasn't using the src attribute.

The manifest additions with the latest version of Java seem to suggest a design conflict.

My experience suggests that salesforce.com's half of the Java loader changed without any appropriate user notification. However, I must admit I am deficient in reviewing ALL of the REAMS of FREQUENTLY released documentation and information.