Mailing Lists: Apple Mailing Lists

Image of Mac OS face in stamp
 
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: How do I debug "old interface" errors?




Hi,

Although I can't help you in setting up a 1.1 environment, I can suggest the following tip to narrow down which class is causing which class to be loaded. If you run java with the "-verbose" flag it traces out each class as it is loaded in turn. For example if you just run "java -verbose" from the command line you get something like:

[D:\ade\gdavison_ct\modelers\src]java -verbose
[Opened d:\jdk\1.5\jre\lib\rt.jar]
[Opened d:\jdk\1.5\jre\lib\jsse.jar]
[Opened d:\jdk\1.5\jre\lib\jce.jar]
[Opened d:\jdk\1.5\jre\lib\charsets.jar]
[Loaded java.lang.Object from shared objects file]
[Loaded java.io.Serializable from shared objects file]
[Loaded java.lang.Comparable from shared objects file]
[Loaded java.lang.CharSequence from shared objects file]
[Loaded java.lang.String from shared objects file]
[Loaded java.lang.reflect.GenericDeclaration from shared objects file]
[Loaded java.lang.reflect.Type from shared objects file]
[Loaded java.lang.reflect.AnnotatedElement from shared objects file]
[Loaded java.lang.Class from shared objects file]
[Loaded java.lang.Cloneable from shared objects file]
[Loaded java.lang.ClassLoader from shared objects file]
[Loaded java.lang.System from shared objects file]
[Loaded java.lang.Throwable from shared objects file]
[Loaded java.lang.Error from shared objects file]
[Loaded java.lang.ThreadDeath from shared objects file]
[Loaded java.lang.Exception from shared objects file]
[Loaded java.lang.RuntimeException from shared objects file]
[Loaded java.security.ProtectionDomain from shared objects file]
[Loaded java.security.AccessControlContext from shared objects file]
[Loaded java.lang.ClassNotFoundException from shared objects file]
[Loaded java.lang.LinkageError from shared objects file]
[Loaded java.lang.NoClassDefFoundError from shared objects file]
[Loaded java.lang.ClassCastException from shared objects file]
[Loaded java.lang.ArrayStoreException from shared objects file]
[Loaded java.lang.VirtualMachineError from shared objects file]


So when running on something with swing involved you might see a line such as:


[Loaded mypackage1.Application1 from ....]
...
[Loaded javax.swing.JFrame from shared objects file]

Knowing the order things are loaded can really help trace down such problems. I regularly use this method to reduce the number of classes loaded at program start up. Sometimes it only takes one object reference to have hundreds of classes loaded. (For example swing)

Indirection is usually the way to go with these problems as you have mentioned; but I figured you might be interested in this technique.

Regards,

Gerard

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

Message: 10
Date: Thu, 16 Dec 2004 20:54:05 -0800
From: David Linker <email@hidden>
Subject: Re: How do I debug "old interface" errors?
To: java dev <email@hidden>
Message-ID: <email@hidden>
Content-Type: text/plain; charset=US-ASCII; format=flowed

Thank you for the replies. I didn't want to lengthen my question by details of my situation, but I see that it would help.

In reply to the many replies I have received:

The target is not just Mac OS, but also any other OS browser, with most of the browsers being Windows. The problem is not theoretical. I wrote the original version using Swing, and found that I was unable to run it on a majority of example "target" machines. These are computers around our hospital, and the goal is for the applet to be accessible from any browser, at any hospital. At our hospital, the computer administrators are very reluctant to install anything new, even a new JVM. Asking all users to install software on their machine would raise the threshold too high, in my opinion.

As a debugging tool, I wrote an applet to find out what VM was running and whether there was Swing. I found all sorts of answers on the hospital computers, with VM's ranging from 1.1.4 to 1.3.x. Some had Swing, some did not.

I have tried to work around it using "indirection", as suggested. I have made "wrapper" classes for each of the gui elements. Each wrapper class instantiates either a Swing or an AWT element, depending on the environment, and the behavior looks the same to the main application.

I am not including Swing class files in the applet.

My question was about trying to debug the problem. I can reproduce it easily by running it in IE, but not within XCode. Therein lies the rub!

DTL




--

Gerard M. Davison, Principal Member of Technical Staff, Oracle JDeveloper, Oracle UK
http://www.orablogs.com/gdavison/


_______________________________________________
Do not post admin requests to the list. They will be ignored.
Java-dev mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
http://lists.apple.com/mailman/options/java-dev/email@hidden

This email sent to email@hidden


Visit the Apple Store online or at retail locations.
1-800-MY-APPLE

Contact Apple | Terms of Use | Privacy Policy

Copyright © 2007 Apple Inc. All rights reserved.