Re: [Beanshell-users] Problems using addClassPath in applets

Patrick Niemeyer <[email protected]> Thu, 26 May 2005 19:23:31 -0500
Newsgroups gmane.comp.java.beanshell.devel
Message-ID <6890675B-EBB3-435D-9AE7-0D8E53EFB873__45268.3166055523$1117154418$gmane$org@pat.net>
On May 22, 2005, at 4:09 AM, Stephen Engwicht wrote:

> I am having trouble adding a classpath as a URL directed to the  
> server when running BeanShell interactively in an applet.

I'm afraid that in general, untrusted applets aren't allowed to  
create classloaders...  Internally, adding to the classpath creates a  
URLClassLoader.

You can test this directly like so:

new URLClassLoader( new URL[] { new URL("someurl") } );

When I try this in Sun's appletviewer I get a security exception  
indicating that the createClassLoader permission is restricted.

I guess the options are to either add the classes to the classpath of  
the applet (the archive attribute of the applet tag or the applet's  
effective classpath in its base directory on the server) or to create  
a signed applet that has full permissions...

I know this is limiting, but it's actually one of BeanShell's strong  
points that because the current implementation is almost entirely  
reflection based, we can operate dynamically in this environment...   
As far as I know, a purely bytecode generating scripting language  
couldn't give you a shell inside an applet at all.

Someone please correct me if I'm horribly wrong about something  
above.  It's been a while since I've done much with applets.


Pat



-------------------------------------------------------
This SF.Net email is sponsored by Yahoo.
Introducing Yahoo! Search Developer Network - Create apps using Yahoo!
Search APIs Find out how you can build Yahoo! directly into your own
Applications - visit http://developer.yahoo.net/?fr=offad-ysdn-ostg-q22005