Login | Register   
LinkedIn
Google+
Twitter
RSS Feed
Download our iPhone app
TODAY'S HEADLINES  |   ARTICLE ARCHIVE  |   FORUMS  |   TIP BANK
Browse DevX
Sign up for e-mail newsletters from DevX


Tip of the Day
Language: Java Language
Expertise: Beginner
Mar 20, 1997

WEBINAR: On-Demand

Unleash Your DevOps Strategy by Synchronizing Application and Database Changes REGISTER >

Will Downloading Java Applets Fill Hard Disk?

Question:
Constant downloading and fear of accumulating masses of useless files is turning me off on Internet. My concept of Java is that exe files, etc., will be on the server, thus eliminating need for constant downloads. Is it possible yet to browse the Web using programs that are there, too? If so, please direct me to the proper course.

Answer:
Java applets behave very much like any other Web data. The Java paradigm is that your applications (Java applets) reside on a Web server along with all the other Web content including HTML pages, GIF images, audio clips, and so on.

When you bring up a page that contains an applet, the applet data (class files) automatically get downloaded onto your system using the HTTP protocol. Once enough of the applet has arrived over the network, your browser will start running the applet on your local system. From that point on, the browser will retrieve any additional class files it needs on the fly from the network. So while the bits reside on your server, the applet itself runs on your local system within the context of the browser.

Of course, as with all other Web data, your browser will cache recently used Java class files on your disk. Each browser typically sets aside several megabytes of disk space for use a data cache. This is useful because if you go back to a page that you've already visited, the browser will no longer have to download the class files again, as long as they haven't been updated since your last visit. To verify that the cache data is recent, however, the browser will have to make a connection to the Web server for each class file and verify its date of modification. If the date matches what was stored in the cache, the browser uses the local copy.

The data cache used by the browser does not grow indefinitely, either. As new files are placed in the cache, old ones get kicked out. So you'll never accumulate the data beyond what your browser is configured to use up -- and you should be able to change this value to your liking in the preferences menu.

By the way, applets are typically very small compared to other Web data. A typical applet is probably around 30 kbytes, the size of a small GIF image. Of course, a large Java applet can use 20 or 30 small class files, and it can get somewhat awkward to check the modification date on those files every time the page is visited. One solution coming down the road is to put all the necessary class files into an archive and treat that one archive file as a single Web item. This feature will be available with Java 1.1, which introduces the notion of Java Archive (JAR) files. The advantage of a scheme like this is that during subsequent visits to a page only a single file has to be checked and updated and so your browser makes fewer HTTP connections to the Web server in order to fetch the applet.

Until JAR file support becomes ubiquitous, you can use Netscape's own version of this solution, which is the ARCHIVE HTML tag, available in Netscape 3.0. It allows the publisher of an applet to put all the applet's class files into an uncompressed ZIP file on the server, and simply reference the ZIP file directly in the applet's HTML tag. For example:

      
      
DevX Pro
 
Comment and Contribute

 

 

 

 

 


(Maximum characters: 1200). You have 1200 characters left.

 

 

Sitemap
Thanks for your registration, follow us on our social networks to keep up-to-date