Java

Introduction to Java :Constructing .Cab File

Fadıl

Building a Cab File

After you have created your ZIP archive, you can then create a CAB (CABinet) file that will contain your compressed and archived applet for Microsoft’s Internet Explorer users. Building CAB files is a little less user-friendly than building ZIP files, since there is no graphical interface like WinZip for creating CAB files.

Instead, you will have to use the command line interface provided by CABARC. CABARC is a compression/archiving program distributed with Microsoft’s SDK located in either the “bin” directory under your main SDK directory or the “bin/packsign” directory.

Introduction to Java :Constructing .Zip File

Fadıl

Building a Zip Archive

The first archive you will want to build is the ZIP archive, the oldest and most supported of the three. For this reason, it should be easy for you to find a ZIP archive generation program for whichever platform you are using. When choosing a ZIP utility program, however, you should be careful to choose one that supports non-8.3 filenames, since Java class files usually have names which are longer.

Introduction to Java : Distributing Applets part-2

Fadıl

.zip, .cab, and .jar

Distribution History

As we noted earlier, for most of the history of Java development, there was really no packaging. For the most part, the developer was required to put each class file as a separate file on the web server in the same hierarchy as the packages defined in your Java files. For example, if you had a com.test.utility package you would need a directory hierarchy of com/test/utility under the directory with the main applet class.

Introduction to Java : Distributing Applets part-1

Fadıl

Introduction

Once you have finalized your applet code, the final stage in the development process will be to determine how to make your program available to browsers on the web.

In the last section, we showed an example of this when we created a class file, referenced it with our HTML, and sat back while web surfers played with our applet.

This approach is realistic for “example” applets and silly little ticker tape programs typical of some Java development, but it may be unrealistic for real-world applications.

Introduction to Java : Building Your First Application part-3

Fadıl

Applet Tag by Example

Here is an example of the code we could use to place the Hello applet we created previously in a web page:

<APPLET WIDTH = "200" HEIGHT = "100"
           CODE = "Hello.class">
</APPLET>

Notice that we gave the applet a specific width and height. For an applet to appear, you must give it a specific width and height. If you don’t want an applet to display (such as when your applet creates a popup frame right away), you can give it a width and height of 0: