Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.gui > #2655

Re: Applets and custom cl

From a24900@googlemail.com.remove-dii-this
Subject Re: Applets and custom cl
Message-ID <1192514749.943212.321590@e9g2000prf.googlegroups.com> (permalink)
Newsgroups comp.lang.java.gui
References <4714322f$0$11556$5a62ac22@per-qv1-newsreader-01.iinet.ne
Date 2011-04-27 15:40 +0000
Organization TDS.net

Show all headers | View raw


  To: comp.lang.java.gui
On Oct 16, 5:38 am, "Qu0ll" <Qu0llSixF...@gmail.com> wrote:
> Is there any reason to use a custom class loader with an applet?  I have an
> applet in which I only want to load a particular class if the corresponding
> content type is required to be rendered by that applet so that the initial
> applet load is as quick as possible.

You don't need an additional class loader. Do not put the particular
class file in a Jar. Just put the class file on the server in the
right directory according to the package name. The applet will try to
load the class first time it is referenced. Since it is not in the Jar
(which has already been sent over the net) the class loader needs to
issues a new HTTP request first time the class is needed.

Of course you have to make absolutely sure the class is not referenced
before you use it. Consider programming against an interface and use
Class.forName() to load an interface implementation (your class) to
make sure you have better control over the class usage.

Then additional HTTP requests bear a certain overhead and delay and
therefore the whole idea of delayed loading a class might not be worse
it.

---
 * Synchronet * The Whitehouse BBS --- whitehouse.hulds.com --- check it out free usenet!
--- Synchronet 3.15a-Win32 NewsLink 1.92
Time Warp of the Future BBS - telnet://time.synchro.net:24

Back to comp.lang.java.gui | Previous | Next | Find similar | Unroll thread


Thread

Re: Applets and custom cl a24900@googlemail.com.remove-dii-this - 2011-04-27 15:40 +0000

csiph-web