Re: How to deploy applet with installed extension ...

Jan Luehe (Jan.Luehe@eng.sun.com)
Mon, 8 Mar 1999 13:33:07 -0800 (PST)

Date: Mon, 8 Mar 1999 13:33:07 -0800 (PST)
From: Jan Luehe <Jan.Luehe@eng.sun.com>
Subject: Re: How to deploy applet with installed extension ...
To: java-security@java.sun.com, tibor@baris.sk

Tibor:

> Applet is using library which I want to install on clients( library is
> big enough ).
> Library cooperate with applet classes this way:
> applet _register_ its classes with this library
> then library creates applet classes instances using Class.forName(
> String)
>
> if I put library to jre/ext directory ( installed extension) then
> library and applet classes lives in different namespaces
> and it is not possible for library to user Class.forName()

The library could determine the applet's classloader
(by calling "<applet>.getClass().getClassLoader()") and then
use that classloader's "loadClass" method to load the applet
classes.

Note that Class.getClassLoader() is security-checked.
It only works if the classloader of the calling class
is the same or an ancestor of the classloader being retured,
or if you have the "getClassLoader" permission. Otherwise,
an AccessControlException will be thrown.

Since classes in the jre/ext directory have all permissions
by default, your library should be able to determine
the applet's classloader.

Jan