Link to home
Start Free TrialLog in
Avatar of mte01
mte01Flag for Lebanon

asked on

Loading Issues with Applet

I have a jar file (that contains resource files) that I am loading with an applet (in a php page) using the ARCHIVE tag; the problem is that the applet is taking too much time to load since the size of the jar file is large; now, since I don't need these resource files in the jar until after the applet loads; is there any way in which I can load the jar upon a certain event in the applet (paint method or something like it)?? any help on any alternative method (that would decrease load time) would be also appreciated
Avatar of Mick Barry
Mick Barry
Flag of Australia image

split your jar such that all the resources that do not need to be availble at load time are in a seperate jar
Avatar of mte01

ASKER

>>objects

Ok; that was the plan, but how do we load that jar at runtime as the applet is running (or after the applet has completed loading)?
Don't include it in the applet tag but simply load it over the network using JarURLConnection
ASKER CERTIFIED SOLUTION
Avatar of CEHJ
CEHJ
Flag of United Kingdom of Great Britain and Northern Ireland image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of mte01

ASKER

>>ebrtek

Yes, the resource files are separately in a jar file

>>objects,CEHJ

I am experimenting right now with both of your methods. Since there are a large number of small images (around 300), I want to try not load them each via a direct URL, I want to load them all in a jar file, but I don't want it to load at startup; I want to load it at some time after the applet has already started, so I guess CEHJ's suggestion of using JarURLConnection should be the solution to my problem - the only thing I am trying right now is to see if I can access the resources normally when using this class in the same way as when they are loaded in the ARCHIVE tag
> I want to try not load them each via a direct URL

why exactly do u want to avoid it?

> the only thing I am trying right now is to see if I can access the resources normally when using this class in the same way as when they are loaded in the ARCHIVE tag

you can't
a seperate class loader would be a better way to load them.
will dig around for some old code we had for doing what it is you are trying.
Avatar of mte01

ASKER

>>objects
>>will dig around for some old code we had for doing what it is you are trying

Many thanks!..I will really really appreciate this!...
Avatar of mte01

ASKER

>>objects

Ok; I did it by using a direct url, but now I have in a certain page 330 separate http requests to retrieve images; I think this is madness; what do you think? Wouldn't having them in a jar to unpack them at runtime be easier
Avatar of mte01

ASKER

I meant wouldn't having them in a jar to unpack them at runtime be faster?
>>the problem is that the applet is taking too much time to load since the size of the jar file is large;

Most of the time is actually occupied by loading the runtime. After the jar has been loaded once, it will be got from cache anyway.

If you remove the jar in question entirely, do you notice much difference? Obviously start from the POV of a completely empty cache
> Wouldn't having them in a jar to unpack them at runtime be easier

depends on your needs, if you can afford the delay of a bigger download then yes.

and remember the download is only going to occur the first time the resource is needed.
>>and remember the download is only going to occur the first time the resource is needed.

(just said that)
:-)