views:

222

answers:

3

I have an html file which has a jar file included in it as an applet. When ever i am opening the html file its getting too much time to load the applet.

Is there any way by which i can reduce this loading time??

+1  A: 

You could use Pack 200 to minimise the size of the JAR file. How much difference this will make depends on how much of the time is spent downloading and how much is the start-up after download.

Dan Dyer
A: 

If your startup time is too slow even when loaded locally, the only thing you can do is to switch to HTML5, Flash or Silverlight. I know it's a bit trolling, but the JVM/sandbox implementation is to blame and there is nothing you can do about it.

The SUN guys really didn't get the requirements for RIA-s. Of course it is always possible that Oracle will speed things up, but Applets are 15 years old and they are this slow since then.

sibidiba
+1  A: 

There's at three major factors in play here.

1) Java startup time. Cold start used to be 5-10 seconds, however this has changed with the Java quickstarter which was part of the Java 1.6 update 10. This is on by default for Windoes XP and 2000 (Vista offers its own pre-loading mechanisms), but maybe you have this disabled (enable information).

2) The download time for your applet. Test it locally and if the startup time is significantly different consider using better compression techniques. Proguard will obfuscate code and reduce the code size by upto 90 percent. 90Kb shouldn't be slow, but this could depend on your network speed and host.

3) The code you're using to initialize the applet. You could temporarily change your init method to just show a hello world button to identify if that is a problem. If you're not happy with the performance you may need to profile your code.

Applet startup time should be around a second (excluding download time). Check you have a fairly recent Java and try a simple Hello World applet.

Pool