Solved

Fast loading of an applet

Posted on 1997-07-18
6
198 Views
Last Modified: 2012-06-22
I have an applet which has a lot of classes (about 100) in it. When the html page (which contains the applet) is loaded, it takes a long time for the first window to come up because it is trying to load all the classes for that applet, before showing the window. Is there some way by which the first window can come up quickly and in the background I load rest of the classes that are needed for the applet.

Also if i zip up the classes, which zip utility should i use so that the zip file works both win MS IE 3.01 and Netscape 3.01.
0
Comment
Question by:vmanocha
  • 3
  • 3
6 Comments
 

Accepted Solution

by:
cromero earned 50 total points
ID: 1223389
You must modify the applet tag in the following way:

<APPLET
  CODE=MyMainClass.class
  WIDTH=nnn
  HEIGHT=nnn
  CODEBASE=.
  ARCHIVE="MyClassesAndMyPackages.zip">
</APPLET>

"codebase=." when all the stuff is in the same directory than the html page. The zip archive "MyClassesAndMyPackages.zip" must contain also the main archive "MyMainClass.class" and all the archives _m_u_s_t_ be packed with no compression. Also they must be packed recursing folders containing classes if you are working with your own packages.

This works only with Netscape Browsers. MS I. Explorer don't understand zip package but MS own format "cabinet".

When your cabinet file is done, for instance, MyClassesAndMyPackages.cab, you must add the tag

<PARAM NAME="CABBASE" VALUE="MyClassesAndMyPackages.cab">

between <APPLET...> and </APPLET>. Then IE is able to understand the code as Netscape is.

You may check out the Microsoft Java developer documentation.

I apologise por my very poor English. Good luck!

Carles Romero, cromero@pie.xtec.es
0
 
LVL 1

Author Comment

by:vmanocha
ID: 1223390
You did not mention anything regarding my query for loading the applet in the background ???


0
 

Expert Comment

by:cromero
ID: 1223391
Well. In the approximation I propose you classes are loaded faster because they travel across the net using a single connection. Without packing class files, they need a particular connection with the server for each of them and this consumes a lot of time...
If you wish to load the other than main class in the background I think you must not pack them anyway but your main class must be very simple and waiting for some event (a button push, for instance) which will fire class loading.

Yours...
0
Why You Should Analyze Threat Actor TTPs

After years of analyzing threat actor behavior, it’s become clear that at any given time there are specific tactics, techniques, and procedures (TTPs) that are particularly prevalent. By analyzing and understanding these TTPs, you can dramatically enhance your security program.

 
LVL 1

Author Comment

by:vmanocha
ID: 1223392
Can you please elaborate on the how will i load the classes inside the applet ? Some sample code will be very helpful.

And also if i put the classes in zip/cab format, how do i make sure that my applet will work will at least with both Netscape (> 3.x) and MS IE (> 3.x) since Netscape can only understand zip and MSIE can only understand cab ?
0
 

Expert Comment

by:cromero
ID: 1223393
Answer to 1st question:
It may look very silly but I think it will work:

class Main extends Applet {
  public void init () {
    //some stuff about layouts, colors, etc. of this first window
    ...
    ...
    Button initButton=new Button("Click here!");
    add(initButton);
  }
  public boolean Action (Event e) {
    // On click over initButton launch the program
    // In this moment class loading begins...
    // You may add a label looking like "Please be patient..." :)
  }
}

Answer to 2nd question:
The HTML code:
<APPLET
 CODE=MyMainClass.class
 WIDTH=nnn
 HEIGHT=nnn
 CODEBASE=.
 ARCHIVE="MyClassesAndMyPackages.zip">
 
 <PARAM NAME="CABBASE" VALUE="MyClassesAndMyPackages.cab">

</APPLET>

will be understood for _b_o_t_h_ Netscape Navigator and MS Internet Explorer.

Yours...
0
 
LVL 1

Author Comment

by:vmanocha
ID: 1223394
thanks for the explanation. but it is still not exactly what i wanted. as far as the second part goes, that is clear. regarding the first part of the question (class loading), i am not clear as to how to load classes in an applet.
0

Featured Post

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Suggested Solutions

Title # Comments Views Activity
array6 challenfge 6 63
parentbit challenge 3 52
JDeveloper 12c for 32 bit 4 34
mockito example issue 8 33
Are you developing a Java application and want to create Excel Spreadsheets? You have come to the right place, this article will describe how you can create Excel Spreadsheets from a Java Application. For the purposes of this article, I will be u…
Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Viewers learn about the “while” loop and how to utilize it correctly in Java. Additionally, viewers begin exploring how to include conditional statements within a while loop and avoid an endless loop. Define While Loop: Basic Example: Explanatio…
This theoretical tutorial explains exceptions, reasons for exceptions, different categories of exception and exception hierarchy.

706 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now