Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Preloading applet classes from a signed jar?

 
James Hodgkiss
Ranch Hand
Posts: 401
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have an applet (called MainApplet) located at applet.htm. The applet takes a while to load...

Before reaching that page, the user first goes to index.htm.

In index.htm, I want to preload the applet classes.

One method I've seen is to deploy a PreLoaderApplet within index.html that uses Class.forName() to preload the MainApplet classes.

The jar that the two applets are in must be signed, but I don't want the user to be presented with the security certificate when he first gets to index.html.

So is there any way I can preload the classes without the user being asked to accept a security certificate?

Thanks in advance,
James
 
Manuel Moons
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I'm wondering why the applets should be signed? Will it be because you are using the Class.forName() method?

If so you can load all classes manually by manually refering them:

So instead of doing this: Class.forName("com.test.PreloadedClass");
You could do this: com.test.PreloadedClass.class.getName();
It should also load the class and no special security requirements are made.

But once again. I'm not sure why you need to sign the applet so maybe this is not the solution for this problem!
Let me know if it works for you!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic