Solved

Multiple .zip files in ARCHIVE of APPLET tag.

Posted on 1998-06-01
15
351 Views
Last Modified: 2013-11-23
I have to (yes, have to) use multiple .zip files which contain my classes in the ARCHIVE clause of the APPLET tag in HTML. Multiple archives are not being accepted by Netscape 4.04 with 1.1 patch (even). That is,
<APPLET ARCHIVE="a.zip, b.zip, c.zip" .....>
</APPLET>
doesn't work. Same is the result with ARCHIVES tag that someone suggested.
Since I have 4 to 5 MB of class files, I absolutely need to have multiple archives to break down the downloading of classes (so do not suggest - pack them into one, or anything like that -- infact I am doing that right now). So, as a work around I need some JavaScript or PERL script to load multiple archives (one after the other) to create the same effect. Let me know if this can be done (if at all) or if you have already done it.

Thanks.
Kaleem.
0
Comment
Question by:mka1
  • 7
  • 6
  • 2
15 Comments
 
LVL 4

Expert Comment

by:evijay
ID: 1221834
I used jar files instead of zip files and they seems to work. For example see this code

        <!DOCTYPE HTML PUBLIC "-//IETF//DTD HTML//EN">
        <!-- @(#)SwingApplet2.html 1.1 97/07/02 -->
        <html>
        <head><title>Swing Applet</title></head>
        <body> <applet code=SwingApplet2.class Archive=test.jar,swingall.jar width=500 height=300>
        </applet>
        </body>
        </html>

Where SwingApplet.java is

import java.awt.*;
                 import java.awt.event.*;
                 import java.net.*;
                 import java.applet.*;
                 import com.sun.java.swing.*;

                 public class SwingApplet extends JApplet {

                     JComboBox combobox;

                     public void init() {

                 // Force SwingApplet to come up in the System L&F
                 String laf = UIManager.getSystemLookAndFeelClassName();
                 try {
                     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
                 } catch (UnsupportedLookAndFeelException exc) {
                     System.err.println("Warning: UnsupportedLookAndFeel: " + laf);
                 } catch (Exception exc) {
                     System.err.println("Error loading " + laf + ": " + exc);
                 }

                         getContentPane().setLayout(new FlowLayout());
                         combobox = new JComboBox();
                         combobox.setEditable(true);
                         getContentPane().add(combobox);
                     }

                     public void stop() {
                         if (combobox != null) {
                             getContentPane().remove(combobox);
                             combobox = null;
                         }
                     }

                      public static void main(String args[]) {
                          SwingApplet applet = new SwingApplet();
                          applet.init();
                          JFrame frame = new JFrame();
                          frame.setBounds(0,0,500,300);
                          frame.getContentPane().add(applet);
                          frame.show();
                          return;
                      }
                 }

Please remove double quotes in the list. may be that is a problem.



0
 
LVL 4

Expert Comment

by:evijay
ID: 1221835
I forgot to tell you that i created test.jar with one class file SwingApplet.class
0
 

Author Comment

by:mka1
ID: 1221836
Did you do it and test in Netscape? Or just appletviewer? Just confirming.

Thanks, Vijay.
You seem to be a gem, whoever you are.

Kaleem.
0
 
LVL 4

Expert Comment

by:evijay
ID: 1221837
Yes i tested it in netscape and also in applet viewer. You test it yourself if you have problem.

Bye the bye, I am using Netscape Communicator 4.05 (I forgot to tell you)
I am very sorry for that.

Vijay


0
 
LVL 5

Expert Comment

by:fontaine
ID: 1221838
I think that you are facing a more fundamental problem: your applet is too huge. I don't know what the context is. The Internet I suppose. In that case, don't even dream that users will load an applet of several Mb, and this each time that they come back to your applet page. So, what to do? The best (only?) solution seems to me to (ask to) pre-install at least the biggest archives at the client-side. Here is an article about that subject:

http://www.javaworld.com/javaworld/jw-06-1997/jw-06-plugins.html

Tell me if this can be considered as an answer.

0
 

Author Comment

by:mka1
ID: 1221839
Fontaine,

Our application (which starts from a base applet) is too huge and too complex, that's why I have given only the portion of problem that I have zeroed in on. With a single Archive the application is a great Intranet tool. We have been using/working/developing and giving successful demonstrations of this tool for almost a year now.

Your article about the alternative made an interesting reading. Thanks Fontaine, I appreciate your attempt and giving me more information on the subject. With security as an important feature and universality as the prime objective, the top brass wouldn't agree to part with certain part of the archive to be present on the client.

Vijay, Fontaine, and anyone interested:

I installed Netscape 4.05 and tried executing my software. I got this queer error message. Any idea why this might be happening? If Netscape 4.05 works exactly like 4.04 with Java 1.1 patch, and allows multiple archives; then that's a solution.

Error in Java Console window:

Netscape Communications Corporation -- Java 1.1.2
Type '?' for options.
Symantec Java! ByteCode Compiler Version 210.065
Copyright (C) 1996-97 Symantec Corporation
# Applet exception: error: java.lang.ClassFormatError: Class already loaded
java.lang.ClassFormatError: Class already loaded
  at java.lang.ClassLoader.defineClass(Compiled Code)
  at netscape.applet.AppletClassLoader.findClass(Compiled Code)
  at netscape.applet.AppletClassLoader.loadClass1(Compiled Code)
  at netscape.applet.AppletClassLoader.loadClass(Compiled Code)
* at java.lang.ClassLoader.loadClassInternal(Compiled Code)
  at mmenu.mmenuApplet.<init>(Compiled Code)
  at netscape.applet.DerivedAppletFrame.run(Compiled Code)
  at java.lang.Thread.run(Compiled Code)

I called this 'queer' because I have never seen any error message like this earlier.

Thanks.
Kaleem.
0
 

Author Comment

by:mka1
ID: 1221840
Correction:

... have never seen any error message like this earlier.

is to be:

... have never seen an error message like this earlier.

Thanks.
Kaleem.
0
IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

 
LVL 4

Expert Comment

by:evijay
ID: 1221841
Kaleem,

Why cant you try me small program that i gave in earlier comment with Netscape 4.05. I am saying this since I can run the program without any problem. Note that the swingall.jar archive is of 1.5 mb space.

Let us then discuss about your problem.

Vijay

0
 

Author Comment

by:mka1
ID: 1221842
Vijay,

First of all, I trust you when you say it runs on your machine.:-)

Anyway, I did go through a test run. I did not have Swing in my classpath, and I put it up. I installed Netscape 4.05 as well.

C:\swing-0.7>javac SwingApplet.java
SwingApplet.java:14: Method getSystemLookAndFeelClassName() not found in class c
om.sun.java.swing.UIManager.
                 String laf = UIManager.getSystemLookAndFeelClassName();
                                                                     ^
SwingApplet.java:16: Method getCrossPlatformLookAndFeelClassName() not found in
class com.sun.java.swing.UIManager.
                     UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndF
eelClassName());

            ^
SwingApplet.java:17: Exception com.sun.java.swing.UnsupportedLookAndFeelExceptio
n is never thrown in the body of the corresponding try statement.
                 } catch (UnsupportedLookAndFeelException exc) {
                   ^
3 errors

After solving these problems ...

I created test.jar, and swingall.jar. Your HTML had SwingApplet2.class, instead of SwingApplet.class.
On executing it through appletviewer ....

C:\swing-0.7>appletviewer test.html
java.lang.Error: can't load com.sun.java.swing.windows.WindowsLookAndFeel
        at com.sun.java.swing.UIManager.initializeDefaultLookAndFeel(UIManager.j
ava:318)
        at com.sun.java.swing.UIManager.initialize(UIManager.java:386)
        at com.sun.java.swing.UIManager.maybeInitialize(UIManager.java:395)
        at com.sun.java.swing.UIManager.getDefaults(UIManager.java:146)
        at com.sun.java.swing.UIManager.getColor(UIManager.java:155)
        at com.sun.java.swing.JPanel.<init>(JPanel.java:50)
        at com.sun.java.swing.JPanel.<init>(JPanel.java:83)
        at com.sun.java.swing.JRootPane.createGlassPane(JRootPane.java:145)
        at com.sun.java.swing.JRootPane.<init>(JRootPane.java:112)
        at com.sun.java.swing.JApplet.createRootPane(JApplet.java:87)
        at com.sun.java.swing.JApplet.addNotify(JApplet.java:76)
        at java.awt.Container.addImpl(Container.java:313)
        at java.awt.Container.add(Container.java:189)
        at sun.applet.AppletPanel.runLoader(AppletPanel.java:440)
        at sun.applet.AppletPanel.run(AppletPanel.java:237)
        at java.lang.Thread.run(Thread.java:474)
java.lang.NullPointerException
        at com.sun.java.swing.JApplet.getContentPane(JApplet.java:115)
        at SwingApplet.init(SwingApplet.java:24)
        at sun.applet.AppletPanel.run(AppletPanel.java:287)
        at java.lang.Thread.run(Thread.java:474)
^C
C:\swing-0.7>

Bottom line is, I cannot spend so much time out of the way to test this example. I fully understand that I have an old version of Swing installed which is causing this compilation problems and L&F problems.

Since Netscape 4.05 is too new to be used for our Intranet product without testing, and since it has a different implementation of JVM from that in 4.04 -- I cannot go on using it until it is cleared for use.

So, the question stays: Does anyone have any other method ... for instance JavaScript or PERL script to dynamically load these multiple jars, if possible.

Thanks.
Kaleem.
0
 
LVL 4

Expert Comment

by:evijay
ID: 1221843
I am very sorry for i gave you the wrong program. I feel that the problem is with some settings in communicator.
Any way, I give up.

0
 

Author Comment

by:mka1
ID: 1221844
Vijay,

   You don't have to be 'sorry' (or is it just that you use the word 'sorry' too much!). You are trying to help me and I am the one who is indebted to you!

   Thanks Vijay! I appreciate your effort. Infact 4.05 may be the solution, but you know how slow it is to implement and test for an organisation; and with personal tight schedules (don't you?)!

------------------------------------

World,

   The question is open.

Thanks.
Kaleem.


0
 
LVL 5

Expert Comment

by:fontaine
ID: 1221845
This info. will probably interest you. Javasoft has developed a plug-in that allows to run the applets on SUN's JRE instead of the browser JRE. Beyond the fact that you have full JDK support without patch, you are also provided with the Swing library. This makes Swing-based applets as quick to load as AWT applets. I invite you to have a look here:

http://www.javasoft.com/products/plugin/

I installed the plug-in and I think that it could interest you.
0
 

Author Comment

by:mka1
ID: 1221846
Thanks Fontaine,

I have used Java Activator earlier and found it very useful. My company did not agree to the use of Java Activator because it was not a released product. You see, my company has to tell to its clients the ingredients of the tool, and Java Activator was not considered "fully baked". Java plug-in 1.1 may be accepted for use by my company soon.

The good news is that I am able to use Netscape 4.05!!! About 4.05, there are 2 versions. The Official release and a developers release (with Java 1.1.5 included). Guess which one I got?

Fontaine, for the information you have given, and the efforts you put, you should get some benefit. So, I'll put a dummy question and answer it to get 100 points from me.

Vijay's solution through Netscape 4.05 has helped me and I wish to give him the promised  200 points.

Thanks a lot Vijay and Fontaine.
Kaleem.
0
 
LVL 4

Accepted Solution

by:
evijay earned 200 total points
ID: 1221847
Here is the answer again for points.
I really am sorry. I forgot to tell you that i installed communicator which is internal (fully latest and bug free) to our intranet.

              Bye the bye, I am using Netscape Communicator 4.05 (I forgot to tell you)

              Vijay
0
 

Author Comment

by:mka1
ID: 1221848
Thanks Vijay!!!

Kaleem.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

In this post we will learn how to connect and configure Android Device (Smartphone etc.) with Android Studio. After that we will run a simple Hello World Program.
Basic understanding on "OO- Object Orientation" is needed for designing a logical solution to solve a problem. Basic OOAD is a prerequisite for a coder to ensure that they follow the basic design of OO. This would help developers to understand the b…
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to implement Singleton Design Pattern in Java.

757 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

22 Experts available now in Live!

Get 1:1 Help Now