I have a fairly simple applet that a customer is trying to use, but it works on some of their PCs and fails to initialize on others. The applet lets the user input a name and password, then encrypts the password and sends the login info back to the server CGI program. At the customer site, all users are running Netscape 4.75 and Win95. I've installed Netscape (I hate NS!) 4.75 on a Win95 computer here but cannot get the applet to fail. See it here: www.intelebook.net/sabretest It fails during initialization before it gets to my init() routine. When I set the 'debug' param for the applet, at the point of failure I get the message: java.lang.NullPointerException at java.lang.StringBuffer.append(Compiled Code) My code had only two places that used StringBuffer and I made a version that removed any StringBuffer code and I get the same message. I'm fairly lost at this point. Any applet experts out there have any insight?
Hi Don! I'm not sure if this will help you, but I tried your link using Netscape 4.73 on a WinNT machine. (Netscape 4.75 may use a different version of Java, I don't know). Anyway, the applet fails every time and when I look in the Java Console for the browser I get the following error:
Netscape Communications Corporation -- Java 1.1.5 Type '?' for options. Symantec Java! ByteCode Compiler Version 210.065 Copyright (C) 1996-97 Symantec Corporation # New applet context: http://www.intelebook.net/sabretest/, contextID=5 # Initializing applet: LoginApplet.class, appletID=45645872, contextID=5 # Starting applet: LoginApplet, appletID=45645872, contextID=5 # Loading classes from downloaded archive file: http://www.intelebook.net/intelebook/LoginApplet.jar java.io.IOException: bad zip file format at netscape.applet.AppletClassLoader.openArchive(Compiled Code) at netscape.applet.AppletClassLoader.openArchive(Compiled Code) at netscape.applet.AppletClassLoader.<init>(Compiled Code) at netscape.applet.AppletClassLoader.getClassLoader(Compiled Code) at netscape.applet.DerivedAppletFrame$LoadAppletEvent.dispatch(Compiled Code) at java.awt.EventDispatchThread$EventPump.dispatchEvents(Compiled Code) at java.awt.EventDispatchThread.run(Compiled Code) at netscape.applet.DerivedAppletFrame$AppletEventDispatchThread.run(Compiled Code) # Unable to load archive http://www.intelebook.net/intelebook/LoginApplet.jar: java.io.IOException: bad zip file format # Loading class LoginApplet # Fetching http://www.intelebook.net/intelebook/LoginApplet.class # Applet exception: class LoginApplet could not be loaded # Applet LoginApplet class LoginApplet could not be loaded
Seems to keep complaining about a bad zip file format. Are all clients using the same version of your jar file? Just a thought. Stephanie
Joined: Feb 05, 2001
Thanks Stephanie. First time that I've seen those error messages.
I will try that but it appears to be a StringBuffer call that isn't in my code. I have a version where I removed my two StringBuffer references and get the same error messages. But, since I can't duplicate the error here, I'm relying on others to perform the test and maybe they aren't doing what I ask them to do.
Joined: Jul 17, 2000
I am using IE 5.0 and the applet loaded properly. No errors. Ashwin.
Don, Here's another idea. Don't assume that just because you changed the applet that it will be reflected in the browser. Both IE and Netscape cache applets and I have had a LOT of trouble when trying to debug applets. In IE, I can't get it to reflect anything other than the cached version of an applet until the NEXT DAY...and yes, I know how to supposedly delete the cache in IE but it doesn't work. In Netscape, you can do it though. Go to Edit->Preferences clear the history and the Loaction Bar...then at the left choose Advanced and then Cache. Clear the Memory Cache and Disk Cache. Not sure if ALL of those are necessary but if you do all of those, it will clear the cache. I can't tell you how many times I've fixed a bug in an applet and opened it in a brower and seen the old version. You have to clear the cache. You may already have done this but wanted to suggest it. I have had problems with StringBuffer like the other person said when I don't initialize to a null string. It yields problems in some cases and not in others. I bet that's the problem. Hope it helps. With Respect, Matt
Joined: Feb 05, 2001
Thanks for the replies. I have verified that the particular computers that my applet doesn't work on don't like it if I create a TextField object with: TextField(10) or TextField("",10) If I create it as TextField(" ",10), it works fine. I've posted a question about this above.